2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 04:22:33 +08:00

feat: 优化日志记录

This commit is contained in:
2026-01-12 20:35:58 +08:00
parent d9837277ff
commit e9b299f874
3 changed files with 12 additions and 3 deletions

View File

@@ -21,7 +21,10 @@ func NewDB(conf *config.Config) (*gorm.DB, error) {
Filename: filepath.Join(app.Root, "panel/storage/logs/db.log"),
MaxSize: 10,
MaxAge: 30,
Compression: "zstd",
LocalTime: true,
RotateAt: []string{"00:00"},
FileMode: 0o600,
Compression: "none",
}
handler := slog.New(slog.NewJSONHandler(tjLogger, nil)).Handler()

View File

@@ -15,7 +15,10 @@ func NewLog(conf *config.Config) *slog.Logger {
Filename: filepath.Join(app.Root, "panel/storage/logs/app.log"),
MaxSize: 10,
MaxAge: 30,
Compression: "zstd",
LocalTime: true,
RotateAt: []string{"00:00"},
FileMode: 0o600,
Compression: "none",
}
level := slog.LevelInfo

View File

@@ -37,7 +37,10 @@ func NewMiddlewares(conf *config.Config, session *sessions.Manager, appRepo biz.
Filename: filepath.Join(app.Root, "panel/storage/logs/http.log"),
MaxSize: 10,
MaxAge: 30,
Compression: "zstd",
LocalTime: true,
RotateAt: []string{"00:00"},
FileMode: 0o600,
Compression: "none",
}
return &Middlewares{