mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
ws handler simplify logging.
This commit is contained in:
parent
fcc85aa9d6
commit
f6eb8d0315
@ -34,11 +34,6 @@ type MessageHandlerCtx struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *MessageHandlerCtx) Message(session types.Session, data types.WebSocketMessage) bool {
|
func (h *MessageHandlerCtx) Message(session types.Session, data types.WebSocketMessage) bool {
|
||||||
logger := h.logger.With().
|
|
||||||
Str("event", data.Event).
|
|
||||||
Str("session_id", session.ID()).
|
|
||||||
Logger()
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
switch data.Event {
|
switch data.Event {
|
||||||
// System Events
|
// System Events
|
||||||
@ -146,7 +141,10 @@ func (h *MessageHandlerCtx) Message(session types.Session, data types.WebSocketM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn().Err(err).Msg("message handler has failed")
|
h.logger.Warn().Err(err).
|
||||||
|
Str("event", data.Event).
|
||||||
|
Str("session_id", session.ID()).
|
||||||
|
Msg("message handler has failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user