add rawlog

This commit is contained in:
zhiqiang feng
2020-12-28 16:36:59 +08:00
parent f9c71978fd
commit 68069dec34
2 changed files with 11 additions and 2 deletions
+7 -2
View File
@@ -58,7 +58,6 @@ Read the telegram from `,
Mode = os.Getenv(ModeName)
logger *zap.Logger
// l *zap.SugaredLogger
)
// Execute adds all child commands to the root command and sets flags appropriately.
@@ -119,7 +118,7 @@ func initConfig() {
}
func initLog() {
logFile := "./log/telegram-%Y-%m-%d-%H.log"
logFile := "./logs/telegram-%Y-%m-%d-%H.log"
rotator, err := rotatelogs.New(
logFile,
rotatelogs.WithMaxAge(60*24*time.Hour),
@@ -128,6 +127,12 @@ func initLog() {
panic(err)
}
rawFile := "./logs/raw-%Y-%m-%d-%H.txt"
utils.RawLog, err = rotatelogs.New(
rawFile,
rotatelogs.WithMaxAge(60*24*time.Hour),
rotatelogs.WithRotationTime(time.Hour))
priority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
return lvl >= zapcore.DebugLevel
})