feat(logging): add log path configuration and implement logrotate policy
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user