feat: windows app update

This commit is contained in:
Simon Ding
2025-04-29 18:54:56 +08:00
parent 3a73d0c33e
commit 5375f66018
14 changed files with 63 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ package log
import (
"os"
"path/filepath"
"polaris/pkg/utils"
"strings"
"github.com/natefinch/lumberjack"
@@ -13,9 +14,6 @@ import (
var sugar *zap.SugaredLogger
var atom zap.AtomicLevel
const dataPath = "./data"
func init() {
InitLogger(false)
}
@@ -27,7 +25,7 @@ func InitLogger(toFile bool) {
w := zapcore.Lock(os.Stdout)
if toFile {
w = zapcore.AddSync(&lumberjack.Logger{
Filename: filepath.Join(dataPath, "logs", "polaris.log"),
Filename: filepath.Join(utils.GetUserDataDir(), "logs", "polaris.log"),
MaxSize: 50, // megabytes
MaxBackups: 3,
MaxAge: 30, // days