Skip to content

Commit

Permalink
messagetracking/sendMessageMetrics: use local log
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jan 6, 2024
1 parent 6168b25 commit 476e0b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions messagetracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,16 @@ func (portal *Portal) sendMessageMetrics(ctx context.Context, evt *event.Event,
if evt.Type == event.EventRedaction {
log = log.With().Stringer("redacts", evt.Redacts).Logger()
}
ctx = log.WithContext(ctx)

origEvtID := evt.ID
if retryMeta := evt.Content.AsMessage().MessageSendRetry; retryMeta != nil {
origEvtID = retryMeta.OriginalEventID
}
if err != nil {
logEvt := portal.log.Error()
logEvt := log.Error()
if part == "Ignoring" {
logEvt = portal.log.Debug()
logEvt = log.Debug()
}
logEvt.Err(err).Msg("Sending message metrics for event")
reason, statusCode, isCertain, sendNotice, _ := errorToStatusReason(err)
Expand All @@ -203,7 +204,7 @@ func (portal *Portal) sendMessageMetrics(ctx context.Context, evt *event.Event,
}
portal.sendStatusEvent(ctx, origEvtID, evt.ID, err, nil)
} else {
portal.log.Debug().Msg("Sending metrics for successfully handled Matrix event")
log.Debug().Msg("Sending metrics for successfully handled Matrix event")
portal.sendDeliveryReceipt(ctx, evt.ID)
portal.bridge.SendMessageSuccessCheckpoint(evt, status.MsgStepRemote, ms.getRetryNum())
var deliveredTo *[]id.UserID
Expand All @@ -218,7 +219,7 @@ func (portal *Portal) sendMessageMetrics(ctx context.Context, evt *event.Event,
}
}
if ms != nil {
portal.log.Debug().Object("timings", ms.timings).Msg("Timings for event")
log.Debug().Object("timings", ms.timings).Msg("Timings for event")
}
}

Expand Down

0 comments on commit 476e0b5

Please sign in to comment.