From 20be557b7bc3d7ada78411b7b279c9f7580d0bc7 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 9 Oct 2023 08:58:31 -0600 Subject: logging.Base() Allow users to get access to the base logger *before* it is wrapped with the various levels. This provides a single override point to filter or redirect all logging. --- examples/gopher_fileserver/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'examples/gopher_fileserver') diff --git a/examples/gopher_fileserver/main.go b/examples/gopher_fileserver/main.go index 1cb7495..9b8c33f 100644 --- a/examples/gopher_fileserver/main.go +++ b/examples/gopher_fileserver/main.go @@ -4,6 +4,7 @@ import ( "context" "log" + "github.com/go-kit/log/level" sr "tildegit.org/tjp/sliderule" "tildegit.org/tjp/sliderule/contrib/cgi" "tildegit.org/tjp/sliderule/contrib/fs" @@ -19,10 +20,10 @@ func main() { fs.GopherFileHandler(".", "", nil), ) - _, infoLog, _, errLog := logging.DefaultLoggers() - handler = logging.LogRequests(infoLog)(handler) + baseLog := logging.Base() + handler = logging.LogRequests(level.Info(baseLog))(handler) - server, err := gopher.NewServer(context.Background(), "localhost", "tcp4", ":70", handler, errLog) + server, err := gopher.NewServer(context.Background(), "localhost", "tcp4", ":70", handler, baseLog) if err != nil { log.Fatal(err) } -- cgit v1.2.3