light преди 6 месеца
родител
ревизия
b3a506527e
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      utils/logger.go

+ 3 - 1
utils/logger.go

@@ -4,6 +4,7 @@ import (
 	"os"
 	"path/filepath"
 	"strings"
+	"time"
 
 	"github.com/natefinch/lumberjack"
 	"github.com/sirupsen/logrus"
@@ -28,7 +29,8 @@ func InitLogger(logDir string, levelConf string) {
 		panic(err)
 	}
 
-	logFile := filepath.Join(logPath, "policy-service.log")
+	currentDate := time.Now().Format("20060102")
+	logFile := filepath.Join(logPath, "policy-service-"+currentDate+".log")
 
 	// 配置日志切割
 	lumberjackLogger := &lumberjack.Logger{