This commit is contained in:
wangchuxiao 2023-03-10 20:55:34 +08:00
parent 012a173629
commit 8ea9484255
2 changed files with 7 additions and 3 deletions

View File

@ -24,8 +24,7 @@ func NewRootCmd() (rootCmd *RootCmd) {
if err != nil { if err != nil {
return err return err
} }
log.InitFromConfig("newlog") return log.InitFromConfig("newlog")
return nil
}, },
} }
rootCmd.Command = c rootCmd.Command = c

View File

@ -69,8 +69,13 @@ func NewZapLogger() (*ZapLogger, error) {
Development: true, Development: true,
Encoding: "json", Encoding: "json",
EncoderConfig: zap.NewProductionEncoderConfig(), EncoderConfig: zap.NewProductionEncoderConfig(),
OutputPaths: []string{config.Config.Log.StorageLocation + "openIM2.log"}, OutputPaths: []string{"stdout", config.Config.Log.StorageLocation + "openIM2.log"},
ErrorOutputPaths: []string{config.Config.Log.StorageLocation}, ErrorOutputPaths: []string{config.Config.Log.StorageLocation},
Sampling: &zap.SamplingConfig{
Initial: 0,
Thereafter: 0,
Hook: nil,
},
} }
l, err := zapConfig.Build() l, err := zapConfig.Build()
if err != nil { if err != nil {