Add missing context to logger calls

This commit is contained in:
Deluan
2022-11-04 11:29:58 -04:00
parent daa428ede7
commit 9c433b5d68
11 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, reqFormat str
var bitRate int
var cached bool
defer func() {
log.Info("Streaming file", "title", mf.Title, "artist", mf.Artist, "format", format, "cached", cached,
log.Info(ctx, "Streaming file", "title", mf.Title, "artist", mf.Artist, "format", format, "cached", cached,
"bitRate", bitRate, "user", userName(ctx), "transcoding", format != "raw",
"originalFormat", mf.Suffix, "originalBitRate", mf.BitRate)
}()
+1 -1
View File
@@ -46,7 +46,7 @@ func (p *players) Register(ctx context.Context, id, client, userAgent, ip string
Client: client,
ScrobbleEnabled: true,
}
log.Info("Registering new player", "id", plr.ID, "client", client, "username", userName, "type", userAgent)
log.Info(ctx, "Registering new player", "id", plr.ID, "client", client, "username", userName, "type", userAgent)
}
}
plr.Name = fmt.Sprintf("%s [%s]", client, userAgent)
+3 -3
View File
@@ -131,16 +131,16 @@ func (p *playTracker) Submit(ctx context.Context, submissions []Submission) erro
for _, s := range submissions {
mf, err := p.ds.MediaFile(ctx).Get(s.TrackID)
if err != nil {
log.Error("Cannot find track for scrobbling", "id", s.TrackID, "user", username, err)
log.Error(ctx, "Cannot find track for scrobbling", "id", s.TrackID, "user", username, err)
continue
}
err = p.incPlay(ctx, mf, s.Timestamp)
if err != nil {
log.Error("Error updating play counts", "id", mf.ID, "track", mf.Title, "user", username, err)
log.Error(ctx, "Error updating play counts", "id", mf.ID, "track", mf.Title, "user", username, err)
} else {
success++
event.With("song", mf.ID).With("album", mf.AlbumID).With("artist", mf.AlbumArtistID)
log.Info("Scrobbled", "title", mf.Title, "artist", mf.Artist, "user", username, "timestamp", s.Timestamp)
log.Info(ctx, "Scrobbled", "title", mf.Title, "artist", mf.Artist, "user", username, "timestamp", s.Timestamp)
if player.ScrobbleEnabled {
p.dispatchScrobble(ctx, mf, s.Timestamp)
}