feat: optional log to std
This commit is contained in:
parent
aa1c5b2be3
commit
dc000f640a
@ -6,4 +6,5 @@ var (
|
|||||||
NoPrefix bool
|
NoPrefix bool
|
||||||
Dev bool
|
Dev bool
|
||||||
ForceBinDir bool
|
ForceBinDir bool
|
||||||
|
LogStd bool
|
||||||
)
|
)
|
||||||
|
@ -29,4 +29,5 @@ func init() {
|
|||||||
RootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix")
|
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.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.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")
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ func Log() {
|
|||||||
MaxAge: logConfig.MaxAge, //days
|
MaxAge: logConfig.MaxAge, //days
|
||||||
Compress: logConfig.Compress, // disabled by default
|
Compress: logConfig.Compress, // disabled by default
|
||||||
}
|
}
|
||||||
if flags.Debug || flags.Dev {
|
if flags.Debug || flags.Dev || flags.LogStd {
|
||||||
w = io.MultiWriter(os.Stdout, w)
|
w = io.MultiWriter(os.Stdout, w)
|
||||||
}
|
}
|
||||||
logrus.SetOutput(w)
|
logrus.SetOutput(w)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user