From a1eb56950582c6197620ca59173b6fd3c6185788 Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Fri, 3 Jun 2022 18:00:31 +0200 Subject: [PATCH] add custom logging section --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c14e892..caa14ea 100644 --- a/README.md +++ b/README.md @@ -840,6 +840,18 @@ y.SetDefault("ContentDir", "foobar") When working with multiple vipers, it is up to the user to keep track of the different vipers. +## Custom Logging + +Viper uses a [jww logger](https://github.com/spf13/jwalterweatherman) by default. +However, any logger can be set on a viper which satisfies the Logger interface +[here](./logger.go). To set a different logger on a viper instance, you can do the +following: + +```go +customLogger := someloggingpackage.NewLogger() + +v := viper.NewWithOptions(viper.WithLogger(customLogger)) +``` ## Q & A