Skip to content

Commit e9bca19

Browse files
committed
Add MarshalZerologObject for MessageDebugTimings
1 parent 79d9175 commit e9bca19

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

send.go

+19
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"strings"
2020
"time"
2121

22+
"github.com/rs/zerolog"
2223
"go.mau.fi/libsignal/groups"
2324
"go.mau.fi/libsignal/keys/prekey"
2425
"go.mau.fi/libsignal/protocol"
@@ -82,6 +83,24 @@ type MessageDebugTimings struct {
8283
Retry time.Duration
8384
}
8485

86+
func (mdt MessageDebugTimings) MarshalZerologObject(evt *zerolog.Event) {
87+
evt.Dur("queue", mdt.Queue)
88+
evt.Dur("marshal", mdt.Marshal)
89+
if mdt.GetParticipants != 0 {
90+
evt.Dur("get_participants", mdt.GetParticipants)
91+
}
92+
evt.Dur("get_devices", mdt.GetDevices)
93+
if mdt.GroupEncrypt != 0 {
94+
evt.Dur("group_encrypt", mdt.GroupEncrypt)
95+
}
96+
evt.Dur("peer_encrypt", mdt.PeerEncrypt)
97+
evt.Dur("send", mdt.Send)
98+
evt.Dur("resp", mdt.Resp)
99+
if mdt.Retry != 0 {
100+
evt.Dur("retry", mdt.Retry)
101+
}
102+
}
103+
85104
type SendResponse struct {
86105
// The message timestamp returned by the server
87106
Timestamp time.Time

0 commit comments

Comments
 (0)