From cb51a2fea779d3510bdf7944b30868499398b620 Mon Sep 17 00:00:00 2001 From: David Thorpe Date: Sat, 27 Jul 2024 13:51:46 +0200 Subject: [PATCH] Check for logger --- pkg/httpserver/httpserver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/httpserver/httpserver.go b/pkg/httpserver/httpserver.go index 9f504a7..195a1e3 100644 --- a/pkg/httpserver/httpserver.go +++ b/pkg/httpserver/httpserver.go @@ -199,7 +199,9 @@ func (self *httpserver) Run(ctx context.Context) error { }() // Log the server is running - provider.Logger(ctx).Printf(ctx, "Starting %v server on %q", self.Type(), self.Addr()) + if log := provider.Logger(ctx); log != nil { + log.Printf(ctx, "Starting %v server on %q", self.Type(), self.Addr()) + } // Run server in foreground, cancel when done if err := self.runInForeground(); err != nil && !errors.Is(err, http.ErrServerClosed) {