修改日志路径bug
This commit is contained in:
parent
cb54278363
commit
6d462b1067
BIN
iniDataForLinux
BIN
iniDataForLinux
Binary file not shown.
BIN
iniDataForMacOs
BIN
iniDataForMacOs
Binary file not shown.
8
main.go
8
main.go
@ -193,7 +193,8 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
applogger = logrus.New()
|
||||
logPath := filepath.Join(executableDir, "logs", time.Now().Format("2006_01"))
|
||||
logPath = filepath.Join(executableDir, "logs", time.Now().Format("2006_01"))
|
||||
err = os.MkdirAll(logPath, 0755)
|
||||
logFileName := "sms_processing_" + time.Now().Format("2006_01_02") + ".log"
|
||||
logFileHook := &lumberjack.Logger{
|
||||
Filename: filepath.Join(logPath, logFileName),
|
||||
@ -210,8 +211,9 @@ func main() {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
// 定时器触发时执行的任务函数
|
||||
logFileName := "sms_processing_" + time.Now().Format("2006_01_02") + ".log"
|
||||
logFileHook := &lumberjack.Logger{
|
||||
logPath = filepath.Join(executableDir, "logs", time.Now().Format("2006_01"))
|
||||
logFileName = "sms_processing_" + time.Now().Format("2006_01_02") + ".log"
|
||||
logFileHook = &lumberjack.Logger{
|
||||
Filename: filepath.Join(logPath, logFileName),
|
||||
}
|
||||
applogger.SetOutput(logFileHook)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user