Skip to content

Commit

Permalink
feat: optional log to std
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Mar 5, 2023
1 parent aa1c5b2 commit dc000f6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/flags/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ var (
NoPrefix bool
Dev bool
ForceBinDir bool
LogStd bool
)
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ func init() {
RootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix")
RootCmd.PersistentFlags().BoolVar(&flags.Dev, "dev", false, "start with dev mode")
RootCmd.PersistentFlags().BoolVar(&flags.ForceBinDir, "force-bin-dir", false, "Force to use the directory where the binary file is located as data directory")
RootCmd.PersistentFlags().BoolVar(&flags.LogStd, "log-std", false, "Force to log to std")
}
2 changes: 1 addition & 1 deletion internal/bootstrap/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Log() {
MaxAge: logConfig.MaxAge, //days
Compress: logConfig.Compress, // disabled by default
}
if flags.Debug || flags.Dev {
if flags.Debug || flags.Dev || flags.LogStd {
w = io.MultiWriter(os.Stdout, w)
}
logrus.SetOutput(w)
Expand Down

0 comments on commit dc000f6

Please sign in to comment.