logging has been changed.

This commit is contained in:
crusader
2017-09-11 12:58:15 +09:00
parent df15f27bca
commit 918775c49b
10 changed files with 47 additions and 70 deletions

View File

@@ -15,8 +15,7 @@ import (
func newWebJSONRpcHandler(ctx context.Context) ogw.ProtocolHandler {
h := &webJSONRpcHandlers{
ctx: ctx,
logger: logging.WithContext(ctx),
ctx: ctx,
}
p := jsonrpc.New(ctx, h)
@@ -26,12 +25,11 @@ func newWebJSONRpcHandler(ctx context.Context) ogw.ProtocolHandler {
type webJSONRpcHandlers struct {
jsonrpc.JSONRpcHandlers
ctx context.Context
logger *zap.Logger
ctx context.Context
}
func (h *webJSONRpcHandlers) OnRequest(soc ogw.Socket, method string, params []string) (interface{}, error) {
h.logger.Info("OnRequest",
logging.Logger.Info("OnRequest",
zap.String("path", soc.Path()),
zap.String("method", method),
zap.Any("params", params),

View File

@@ -5,22 +5,18 @@ import (
"time"
"git.loafle.net/commons_go/config"
"git.loafle.net/commons_go/logging"
ogw "git.loafle.net/overflow/overflow_gateway_websocket"
"go.uber.org/zap"
)
type webSocketHandlers struct {
ogw.SocketHandlers
ctx context.Context
logger *zap.Logger
cfg config.Configurator
ctx context.Context
cfg config.Configurator
}
func NewWebSocketHandler(ctx context.Context) ogw.SocketHandler {
h := &webSocketHandlers{
ctx: ctx,
logger: logging.WithContext(ctx),
ctx: ctx,
}
h.cfg = config.Sub("handlers.web")
h.MaxMessageSize = h.cfg.GetInt64("socket.MaxMessageSize")