Skip to content

Commit

Permalink
Add MarshalZerologObject for MessageDebugTimings
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Mar 11, 2024
1 parent 79d9175 commit e9bca19
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"strings"
"time"

"github.com/rs/zerolog"
"go.mau.fi/libsignal/groups"
"go.mau.fi/libsignal/keys/prekey"
"go.mau.fi/libsignal/protocol"
Expand Down Expand Up @@ -82,6 +83,24 @@ type MessageDebugTimings struct {
Retry time.Duration
}

func (mdt MessageDebugTimings) MarshalZerologObject(evt *zerolog.Event) {
evt.Dur("queue", mdt.Queue)
evt.Dur("marshal", mdt.Marshal)
if mdt.GetParticipants != 0 {
evt.Dur("get_participants", mdt.GetParticipants)
}
evt.Dur("get_devices", mdt.GetDevices)
if mdt.GroupEncrypt != 0 {
evt.Dur("group_encrypt", mdt.GroupEncrypt)
}
evt.Dur("peer_encrypt", mdt.PeerEncrypt)
evt.Dur("send", mdt.Send)
evt.Dur("resp", mdt.Resp)
if mdt.Retry != 0 {
evt.Dur("retry", mdt.Retry)
}
}

type SendResponse struct {
// The message timestamp returned by the server
Timestamp time.Time
Expand Down

0 comments on commit e9bca19

Please sign in to comment.