feat(logging): add log path configuration and implement logrotate policy

This commit is contained in:
2026-05-22 17:27:57 +08:00
parent 767f26f3c9
commit a2d1dada2c
5 changed files with 62 additions and 5 deletions
+10
View File
@@ -64,6 +64,16 @@ func main() {
postLog.Fatal(fmt.Sprintf("Failed to initialize frpc database: %v", err))
}
if global.CurrentConfig.LogsPath != "" && !global.CurrentConfig.Status.IsLogrotateConfigured { // Set up logrotate policy if LogsPath is configured
if err := sys.CreateLogrotatePolicy(); err != nil {
postLog.Fatal(fmt.Sprintf("Failed to create logrotate policy: %v", err))
} else {
global.CurrentConfig.Status.IsLogrotateConfigured = true
config.SaveConfig()
postLog.Info("Logrotate policy has been configured successfully.")
}
}
frpLogger.SetDatabase(global.ConfigDB, global.FrpcDB)
frpLogger.SetDebugMode(global.CurrentConfig.Debug)