logger for RpcContext
This commit is contained in:
parent
d9ca9a8c75
commit
b079835cb3
|
@ -16,6 +16,7 @@ import (
|
|||
"git.bit5.ru/gomodules/metadb"
|
||||
"github.com/doug-martin/goqu/v9"
|
||||
"github.com/doug-martin/goqu/v9/exp"
|
||||
"github.com/go-logr/logr"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -104,6 +105,8 @@ type CreateRpcFunc func(uint32) (Rpc, error)
|
|||
|
||||
type RpcContext struct {
|
||||
ctx context.Context
|
||||
logger logr.Logger
|
||||
|
||||
ip net.IP
|
||||
version versioning.Version
|
||||
platform uint8
|
||||
|
@ -129,23 +132,23 @@ func NewRpcContext(
|
|||
}
|
||||
}
|
||||
|
||||
func (rctx RpcContext) Context() context.Context {
|
||||
func (rctx *RpcContext) Context() context.Context {
|
||||
return rctx.ctx
|
||||
}
|
||||
|
||||
func (rctx RpcContext) IP() net.IP {
|
||||
func (rctx *RpcContext) IP() net.IP {
|
||||
return rctx.ip
|
||||
}
|
||||
|
||||
func (rctx RpcContext) Version() versioning.Version {
|
||||
func (rctx *RpcContext) Version() versioning.Version {
|
||||
return rctx.version
|
||||
}
|
||||
|
||||
func (rctx RpcContext) Platform() uint8 {
|
||||
func (rctx *RpcContext) Platform() uint8 {
|
||||
return rctx.platform
|
||||
}
|
||||
|
||||
func (rctx RpcContext) ExtraValue(key string) (string, bool) {
|
||||
func (rctx *RpcContext) ExtraValue(key string) (string, bool) {
|
||||
if rctx.extras == nil {
|
||||
return "", false
|
||||
}
|
||||
|
@ -159,10 +162,18 @@ func (rctx *RpcContext) SetPlayer(playerId uint32, extId string) {
|
|||
rctx.extId = extId
|
||||
}
|
||||
|
||||
func (rctx RpcContext) PlayerId() uint32 {
|
||||
func (rctx *RpcContext) PlayerId() uint32 {
|
||||
return rctx.playerId
|
||||
}
|
||||
|
||||
func (rctx RpcContext) ExtId() string {
|
||||
func (rctx *RpcContext) ExtId() string {
|
||||
return rctx.extId
|
||||
}
|
||||
|
||||
func (rctx *RpcContext) SetLogger(logger logr.Logger) {
|
||||
rctx.logger = logger
|
||||
}
|
||||
|
||||
func (rctx *RpcContext) Logger() logr.Logger {
|
||||
return rctx.logger
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue