mirror of
https://github.com/spf13/viper
synced 2025-05-11 22:57:21 +00:00
add custom logging section
This commit is contained in:
parent
c02f8ef627
commit
a1eb569505
1 changed files with 12 additions and 0 deletions
12
README.md
12
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
|
When working with multiple vipers, it is up to the user to keep track of the
|
||||||
different vipers.
|
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
|
## Q & A
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue