🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Fix logging when first arg is a context.Context without a logger
Deluan46f1b338129c
diff --git a/log/log.go b/log/log.goindex ceffefe1f..7532ef51b 100644--- a/log/log.go+++ b/log/log.go@@ -180,6 +180,7 @@ func extractLogger(ctx interface{}) (*logrus.Entry, error) {if logger != nil {return logger.(*logrus.Entry), nil}+ return extractLogger(NewContext(ctx))case *http.Request:return extractLogger(ctx.Context())}diff --git a/log/log_test.go b/log/log_test.goindex 9ef382648..eca2a42dd 100644--- a/log/log_test.go+++ b/log/log_test.go@@ -41,8 +41,8 @@ var _ = Describe("Logger", func() {Expect(hook.LastEntry().Data).To(BeEmpty())})- XIt("Empty context", func() {- Error(context.Background(), "Simple Message")+ It("Empty context", func() {+ Error(context.TODO(), "Simple Message")Expect(hook.LastEntry().Message).To(Equal("Simple Message"))Expect(hook.LastEntry().Data).To(BeEmpty())})