mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Add a request ID and include it in logs (#1476)
This adds a lightweight form of tracing to GTS. Each incoming request is assigned a Request ID which we then pass on and log in all our log lines. Any function that gets called downstream from an HTTP handler should now emit a requestID=value pair whenever it logs something. Co-authored-by: kim <grufwub@gmail.com>
This commit is contained in:
@@ -82,7 +82,7 @@ func (c *converter) ASRepresentationToAccount(ctx context.Context, accountable a
|
||||
|
||||
// account emojis (used in bio, display name, fields)
|
||||
if emojis, err := ap.ExtractEmojis(accountable); err != nil {
|
||||
log.Infof("ASRepresentationToAccount: error extracting account emojis: %s", err)
|
||||
log.Infof(nil, "error extracting account emojis: %s", err)
|
||||
} else {
|
||||
acct.Emojis = emojis
|
||||
}
|
||||
@@ -217,13 +217,13 @@ func (c *converter) extractAttachments(i ap.WithAttachment) []*gtsmodel.MediaAtt
|
||||
|
||||
attachmentable, ok := t.(ap.Attachmentable)
|
||||
if !ok {
|
||||
log.Error("ap attachment was not attachmentable")
|
||||
log.Error(nil, "ap attachment was not attachmentable")
|
||||
continue
|
||||
}
|
||||
|
||||
attachment, err := ap.ExtractAttachment(attachmentable)
|
||||
if err != nil {
|
||||
log.Errorf("error extracting attachment: %s", err)
|
||||
log.Errorf(nil, "error extracting attachment: %s", err)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ func (c *converter) ASFlagToReport(ctx context.Context, flaggable ap.Flaggable)
|
||||
return nil, fmt.Errorf("ASFlagToReport: db error getting status with url %s: %w", statusURIString, err)
|
||||
}
|
||||
|
||||
log.Warnf("ASFlagToReport: reported status %s could not be found in the db, skipping it", statusURIString)
|
||||
log.Warnf(nil, "reported status %s could not be found in the db, skipping it", statusURIString)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user