docs: 配置日志格式化
This commit is contained in:
@@ -189,42 +189,45 @@ func (m *Manager) DisplayServerConfig() {
|
|||||||
logConfig := m.GetLogConfig()
|
logConfig := m.GetLogConfig()
|
||||||
dbConfig := m.GetDatabaseConfig()
|
dbConfig := m.GetDatabaseConfig()
|
||||||
|
|
||||||
logrus.Info("--- Server Configuration ---")
|
logrus.Info("")
|
||||||
logrus.Infof(" Listen Address: %s:%d", serverConfig.Host, serverConfig.Port)
|
logrus.Info("======= Server Configuration =======")
|
||||||
logrus.Infof(" Graceful Shutdown Timeout: %d seconds", serverConfig.GracefulShutdownTimeout)
|
logrus.Info(" --- Server ---")
|
||||||
logrus.Infof(" Read Timeout: %d seconds", serverConfig.ReadTimeout)
|
logrus.Infof(" Listen Address: %s:%d", serverConfig.Host, serverConfig.Port)
|
||||||
logrus.Infof(" Write Timeout: %d seconds", serverConfig.WriteTimeout)
|
logrus.Infof(" Graceful Shutdown Timeout: %d seconds", serverConfig.GracefulShutdownTimeout)
|
||||||
logrus.Infof(" Idle Timeout: %d seconds", serverConfig.IdleTimeout)
|
logrus.Infof(" Read Timeout: %d seconds", serverConfig.ReadTimeout)
|
||||||
|
logrus.Infof(" Write Timeout: %d seconds", serverConfig.WriteTimeout)
|
||||||
|
logrus.Infof(" Idle Timeout: %d seconds", serverConfig.IdleTimeout)
|
||||||
|
|
||||||
logrus.Info("--- Performance ---")
|
logrus.Info(" --- Performance ---")
|
||||||
logrus.Infof(" Max Concurrent Requests: %d", perfConfig.MaxConcurrentRequests)
|
logrus.Infof(" Max Concurrent Requests: %d", perfConfig.MaxConcurrentRequests)
|
||||||
|
|
||||||
logrus.Info("--- Security ---")
|
logrus.Info(" --- Security ---")
|
||||||
logrus.Infof(" Authentication: enabled (key loaded)")
|
logrus.Infof(" Authentication: enabled (key loaded)")
|
||||||
corsStatus := "disabled"
|
corsStatus := "disabled"
|
||||||
if corsConfig.Enabled {
|
if corsConfig.Enabled {
|
||||||
corsStatus = fmt.Sprintf("enabled (Origins: %s)", strings.Join(corsConfig.AllowedOrigins, ", "))
|
corsStatus = fmt.Sprintf("enabled (Origins: %s)", strings.Join(corsConfig.AllowedOrigins, ", "))
|
||||||
}
|
}
|
||||||
logrus.Infof(" CORS: %s", corsStatus)
|
logrus.Infof(" CORS: %s", corsStatus)
|
||||||
|
|
||||||
logrus.Info("--- Logging ---")
|
logrus.Info(" --- Logging ---")
|
||||||
logrus.Infof(" Log Level: %s", logConfig.Level)
|
logrus.Infof(" Log Level: %s", logConfig.Level)
|
||||||
logrus.Infof(" Log Format: %s", logConfig.Format)
|
logrus.Infof(" Log Format: %s", logConfig.Format)
|
||||||
logrus.Infof(" File Logging: %t", logConfig.EnableFile)
|
logrus.Infof(" File Logging: %t", logConfig.EnableFile)
|
||||||
if logConfig.EnableFile {
|
if logConfig.EnableFile {
|
||||||
logrus.Infof(" Log File Path: %s", logConfig.FilePath)
|
logrus.Infof(" Log File Path: %s", logConfig.FilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Info("--- Dependencies ---")
|
logrus.Info(" --- Dependencies ---")
|
||||||
if dbConfig.DSN != "" {
|
if dbConfig.DSN != "" {
|
||||||
logrus.Info(" Database: configured")
|
logrus.Info(" Database: configured")
|
||||||
} else {
|
} else {
|
||||||
logrus.Info(" Database: not configured")
|
logrus.Info(" Database: not configured")
|
||||||
}
|
}
|
||||||
if m.config.RedisDSN != "" {
|
if m.config.RedisDSN != "" {
|
||||||
logrus.Info(" Redis: configured")
|
logrus.Info(" Redis: configured")
|
||||||
} else {
|
} else {
|
||||||
logrus.Info(" Redis: not configured")
|
logrus.Info(" Redis: not configured")
|
||||||
}
|
}
|
||||||
logrus.Info("--------------------------")
|
logrus.Info("====================================")
|
||||||
|
logrus.Info("")
|
||||||
}
|
}
|
||||||
|
@@ -349,22 +349,25 @@ func (sm *SystemSettingsManager) ValidateGroupConfigOverrides(configMap map[stri
|
|||||||
|
|
||||||
// DisplaySystemConfig displays the current system settings.
|
// DisplaySystemConfig displays the current system settings.
|
||||||
func (sm *SystemSettingsManager) DisplaySystemConfig(settings types.SystemSettings) {
|
func (sm *SystemSettingsManager) DisplaySystemConfig(settings types.SystemSettings) {
|
||||||
logrus.Info("--- System Settings ---")
|
logrus.Info("")
|
||||||
logrus.Infof(" App URL: %s", settings.AppUrl)
|
logrus.Info("========= System Settings =========")
|
||||||
logrus.Infof(" Request Log Retention: %d days", settings.RequestLogRetentionDays)
|
logrus.Info(" --- Basic Settings ---")
|
||||||
logrus.Infof(" Request Log Write Interval: %d minutes", settings.RequestLogWriteIntervalMinutes)
|
logrus.Infof(" App URL: %s", settings.AppUrl)
|
||||||
|
logrus.Infof(" Request Log Retention: %d days", settings.RequestLogRetentionDays)
|
||||||
|
logrus.Infof(" Request Log Write Interval: %d minutes", settings.RequestLogWriteIntervalMinutes)
|
||||||
|
|
||||||
logrus.Info("--- Request Behavior ---")
|
logrus.Info(" --- Request Behavior ---")
|
||||||
logrus.Infof(" Request Timeout: %d seconds", settings.RequestTimeout)
|
logrus.Infof(" Request Timeout: %d seconds", settings.RequestTimeout)
|
||||||
logrus.Infof(" Connect Timeout: %d seconds", settings.ConnectTimeout)
|
logrus.Infof(" Connect Timeout: %d seconds", settings.ConnectTimeout)
|
||||||
logrus.Infof(" Response Header Timeout: %d seconds", settings.ResponseHeaderTimeout)
|
logrus.Infof(" Response Header Timeout: %d seconds", settings.ResponseHeaderTimeout)
|
||||||
logrus.Infof(" Idle Connection Timeout: %d seconds", settings.IdleConnTimeout)
|
logrus.Infof(" Idle Connection Timeout: %d seconds", settings.IdleConnTimeout)
|
||||||
logrus.Infof(" Max Idle Connections: %d", settings.MaxIdleConns)
|
logrus.Infof(" Max Idle Connections: %d", settings.MaxIdleConns)
|
||||||
logrus.Infof(" Max Idle Connections Per Host: %d", settings.MaxIdleConnsPerHost)
|
logrus.Infof(" Max Idle Connections Per Host: %d", settings.MaxIdleConnsPerHost)
|
||||||
|
|
||||||
logrus.Info("--- Key & Group Behavior ---")
|
logrus.Info(" --- Key & Group Behavior ---")
|
||||||
logrus.Infof(" Max Retries: %d", settings.MaxRetries)
|
logrus.Infof(" Max Retries: %d", settings.MaxRetries)
|
||||||
logrus.Infof(" Blacklist Threshold: %d", settings.BlacklistThreshold)
|
logrus.Infof(" Blacklist Threshold: %d", settings.BlacklistThreshold)
|
||||||
logrus.Infof(" Key Validation Interval: %d minutes", settings.KeyValidationIntervalMinutes)
|
logrus.Infof(" Key Validation Interval: %d minutes", settings.KeyValidationIntervalMinutes)
|
||||||
logrus.Info("-----------------------")
|
logrus.Info("====================================")
|
||||||
|
logrus.Info("")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user