Log all pblite response contents
This commit is contained in:
parent
08cbe12181
commit
cb7e12290b
3 changed files with 14 additions and 7 deletions
|
@ -21,6 +21,15 @@ func (r *RPC) deduplicateHash(hash [32]byte) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RPC) logContent(res *pblite.Response) {
|
||||||
|
if r.client.Logger.Trace().Enabled() && res.Data.Decrypted != nil {
|
||||||
|
r.client.Logger.Trace().
|
||||||
|
Str("proto_name", string(res.Data.Decrypted.ProtoReflect().Descriptor().FullName())).
|
||||||
|
Str("data", base64.StdEncoding.EncodeToString(res.Data.RawDecrypted)).
|
||||||
|
Msg("Got event")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r *RPC) deduplicateUpdate(response *pblite.Response) bool {
|
func (r *RPC) deduplicateUpdate(response *pblite.Response) bool {
|
||||||
if response.Data.RawDecrypted != nil {
|
if response.Data.RawDecrypted != nil {
|
||||||
contentHash := sha256.Sum256(response.Data.RawDecrypted)
|
contentHash := sha256.Sum256(response.Data.RawDecrypted)
|
||||||
|
@ -28,13 +37,7 @@ func (r *RPC) deduplicateUpdate(response *pblite.Response) bool {
|
||||||
r.client.Logger.Trace().Hex("data_hash", contentHash[:]).Msg("Ignoring duplicate update")
|
r.client.Logger.Trace().Hex("data_hash", contentHash[:]).Msg("Ignoring duplicate update")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if r.client.Logger.Trace().Enabled() {
|
r.logContent(response)
|
||||||
r.client.Logger.Trace().
|
|
||||||
Str("proto_name", string(response.Data.Decrypted.ProtoReflect().Descriptor().FullName())).
|
|
||||||
Str("data", base64.StdEncoding.EncodeToString(response.Data.RawDecrypted)).
|
|
||||||
Hex("data_hash", contentHash[:]).
|
|
||||||
Msg("Got event")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ func (s *SessionHandler) respondToRequestChannel(res *pblite.Response) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("responding to request")
|
s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("responding to request")
|
||||||
|
s.client.rpc.logContent(res)
|
||||||
actionResponseChan.response = res
|
actionResponseChan.response = res
|
||||||
actionResponseChan.wg.Done()
|
actionResponseChan.wg.Done()
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,11 @@ func (c *Client) handleUpdatesEvent(res *pblite.Response) {
|
||||||
|
|
||||||
switch evt := data.Event.(type) {
|
switch evt := data.Event.(type) {
|
||||||
case *binary.UpdateEvents_UserAlertEvent:
|
case *binary.UpdateEvents_UserAlertEvent:
|
||||||
|
c.rpc.logContent(res)
|
||||||
c.handleUserAlertEvent(res, evt.UserAlertEvent)
|
c.handleUserAlertEvent(res, evt.UserAlertEvent)
|
||||||
|
|
||||||
case *binary.UpdateEvents_SettingsEvent:
|
case *binary.UpdateEvents_SettingsEvent:
|
||||||
|
c.rpc.logContent(res)
|
||||||
c.handleSettingsEvent(res, evt.SettingsEvent)
|
c.handleSettingsEvent(res, evt.SettingsEvent)
|
||||||
|
|
||||||
case *binary.UpdateEvents_ConversationEvent:
|
case *binary.UpdateEvents_ConversationEvent:
|
||||||
|
@ -35,6 +37,7 @@ func (c *Client) handleUpdatesEvent(res *pblite.Response) {
|
||||||
c.triggerEvent(evt.MessageEvent.GetData())
|
c.triggerEvent(evt.MessageEvent.GetData())
|
||||||
|
|
||||||
case *binary.UpdateEvents_TypingEvent:
|
case *binary.UpdateEvents_TypingEvent:
|
||||||
|
c.rpc.logContent(res)
|
||||||
c.handleTypingEvent(res, evt.TypingEvent.GetData())
|
c.handleTypingEvent(res, evt.TypingEvent.GetData())
|
||||||
default:
|
default:
|
||||||
c.Logger.Debug().Any("evt", evt).Any("res", res).Msg("Got unknown event type")
|
c.Logger.Debug().Any("evt", evt).Any("res", res).Msg("Got unknown event type")
|
||||||
|
|
Loading…
Reference in a new issue