Skip to content

Commit

Permalink
update log module.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Sep 29, 2024
1 parent d200122 commit a99b76a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ remainLogLevel: 6
isStdout: false
# Whether to log in JSON format, default is acceptable
isJson: false
# output simplify log when KeyAndValues's value len is bigger than 50 in rpc method log
isSimplify: true
8 changes: 4 additions & 4 deletions pkg/common/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"path/filepath"

"github.com/openimsdk/chat/pkg/common/config"
"github.com/openimsdk/chat/version/version"

"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/log"
Expand Down Expand Up @@ -121,16 +122,15 @@ func (r *RootCmd) initializeLogger(cmdOpts *CmdOpts) error {
err := log.InitLoggerFromConfig(
cmdOpts.loggerPrefixName,
r.processName,
"",
"",
"", "",
r.log.RemainLogLevel,
r.log.IsStdout,
r.log.IsJson,
r.log.StorageLocation,
r.log.RemainRotationCount,
r.log.RotationTime,
config.Version,
false,
version.Version,
r.log.IsSimplify,
)
if err != nil {
return errs.Wrap(err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
_ "embed"

"github.com/openimsdk/tools/db/mongoutil"
"github.com/openimsdk/tools/db/redisutil"
)
Expand Down Expand Up @@ -165,5 +166,6 @@ type Log struct {
RemainLogLevel int `mapstructure:"remainLogLevel"`
IsStdout bool `mapstructure:"isStdout"`
IsJson bool `mapstructure:"isJson"`
IsSimplify bool `mapstructure:"isSimplify"`
WithStack bool `mapstructure:"withStack"`
}

0 comments on commit a99b76a

Please sign in to comment.