Fix some logs

This commit is contained in:
Tulir Asokan 2024-06-08 16:19:28 +03:00
parent 0c7e11d8f0
commit 56bfc105ed
2 changed files with 9 additions and 4 deletions

View file

@ -185,10 +185,13 @@ func (c *Client) HandleRPCMsg(rawMsg *gmproto.IncomingRPCMessage) {
if c.sessionHandler.receiveResponse(msg) {
return
}
c.Logger.Debug().
Stringer("message_action", msg.Message.Action).
logEvt := c.Logger.Debug().
Str("message_id", msg.ResponseID).
Msg("Received message")
Stringer("bugle_route", msg.BugleRoute)
if msg.Message != nil {
logEvt.Stringer("message_action", msg.Message.Action)
}
logEvt.Msg("Received message")
switch msg.BugleRoute {
case gmproto.BugleRoute_PairEvent:
c.handlePairingEvent(msg)

View file

@ -130,9 +130,11 @@ func (s *SessionHandler) receiveResponse(msg *IncomingRPCMessage) bool {
delete(s.responseWaiters, requestID)
s.responseWaitersLock.Unlock()
evt := s.client.Logger.Debug().
Stringer("message_action", msg.Message.Action).
Str("request_message_id", requestID).
Str("response_message_id", msg.ResponseID)
if msg.Message != nil {
evt.Stringer("message_action", msg.Message.Action)
}
if s.client.Logger.GetLevel() == zerolog.TraceLevel {
if msg.DecryptedData != nil {
evt.Str("data", base64.StdEncoding.EncodeToString(msg.DecryptedData))