|
@@ -1,33 +0,0 @@
|
|
|
-# Usage
|
|
|
-
|
|
|
-Example code:
|
|
|
-
|
|
|
-```go
|
|
|
-package example
|
|
|
-
|
|
|
-import (
|
|
|
- "git.swzry.com/zry/GoHiedaLogger/hieda_viper_util"
|
|
|
- "git.swzry.com/zry/GoHiedaLogger/hiedalog"
|
|
|
- "github.com/spf13/viper"
|
|
|
-)
|
|
|
-
|
|
|
-func main() {
|
|
|
- viperCfg := viper.New()
|
|
|
- // ...
|
|
|
- logCfg := viperCfg.Sub("log.hieda")
|
|
|
- // refer to viper's documentation.
|
|
|
- logger := hiedalog.NewHiedaLogger()
|
|
|
- // ...
|
|
|
- vu := NewViperUtil(logger, logCfg)
|
|
|
- // at the part of viper default config adding
|
|
|
- viperCfg.SetDefault("example.key", "value")
|
|
|
- // ...
|
|
|
- vu.SetDefaults()
|
|
|
- // ...
|
|
|
- // the time to initialize the backends
|
|
|
- vu.InitBackends()
|
|
|
- //...
|
|
|
- // then you can do your log
|
|
|
- logger.LogString("example", hiedalog.DLN_INFO, "log example.")
|
|
|
-}
|
|
|
-```
|