add rawlog
This commit is contained in:
+7
-2
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user