Log events

This commit is contained in:
Jannis Mattheis
2020-10-09 08:03:56 +00:00
parent d0cab7abb7
commit d4518eaf89
+2
View File
@@ -108,6 +108,7 @@ func (c *Client) startReading(pongWait time.Duration) {
_ = c.conn.CloseHandler()(websocket.CloseNormalClosure, fmt.Sprintf("malformed message: %s", err))
return
}
log.Debug().Interface("event", fmt.Sprintf("%T", incoming)).Str("room", c.info.RoomID).Str("addr", c.conn.RemoteAddr().String()).Msg("Receive Event")
c.read <- ClientMessage{Info: c.info, Incoming: incoming}
}
}
@@ -133,6 +134,7 @@ func (c *Client) startWriteHandler(pingPeriod time.Duration) {
_ = c.conn.SetWriteDeadline(time.Now().Add(writeWait))
typed, err := ToTypedOutgoing(message)
log.Debug().Interface("event", typed.Type).Str("room", c.info.RoomID).Str("addr", c.conn.RemoteAddr().String()).Msg("Send Event")
if err != nil {
log.Debug().Err(err).Msg("could not get typed message, exiting connection.")
return