28 lines
484 B
Go
28 lines
484 B
Go
|
|
package log
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
"go.uber.org/zap"
|
||
|
|
)
|
||
|
|
|
||
|
|
func NewCustomZapConfig() zap.Config {
|
||
|
|
rawJSON := []byte(`{
|
||
|
|
"level": "debug",
|
||
|
|
"development": false,
|
||
|
|
"sampling": {
|
||
|
|
"initial": 100,
|
||
|
|
"thereafter": 100
|
||
|
|
},
|
||
|
|
"disableCaller": true,
|
||
|
|
"encoding": "json",
|
||
|
|
"OutputPaths": ["stdout"],
|
||
|
|
"ErrorOutputPaths": ["stderr"]
|
||
|
|
}`)
|
||
|
|
|
||
|
|
var cfg zap.Config
|
||
|
|
if err := json.Unmarshal(rawJSON, &cfg); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return cfg
|
||
|
|
}
|