mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
feat: windows app update
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user