From 57b7be8cbbda6183f9476702b81e9c6ef1256d9b Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 26 Jun 2023 16:07:18 -0600 Subject: [PATCH] logging: remove 'Starting' log and use duration instead Signed-off-by: Sumner Evans --- portal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/portal.go b/portal.go index 63f75e4..f13c69a 100644 --- a/portal.go +++ b/portal.go @@ -622,8 +622,8 @@ func (portal *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Mess log.Debug().Msg("Dropping duplicate message") return } - log.Debug().Msg("Starting handling of Discord message") + handlingStartTime := time.Now() puppet := portal.bridge.GetPuppetByID(msg.Author.ID) puppet.UpdateInfo(user, msg.Author, msg) intent := puppet.IntentFor(portal) @@ -678,6 +678,8 @@ func (portal *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Mess dbParts = append(dbParts, database.MessagePart{AttachmentID: part.AttachmentID, MXID: resp.EventID}) eventIDs.Str(part.AttachmentID, resp.EventID.String()) } + + log = log.With().Dur("handling_time", time.Since(handlingStartTime)).Logger() if len(parts) == 0 { log.Warn().Msg("Unhandled message") } else if len(dbParts) == 0 {