Add dynamic log level adjustment and "type" field to auth files response

- Introduced `SetLogLevel` utility function for unified log level management.
- Updated dynamic log level handling across server and watcher components.
- Extended auth files response by extracting and including the `type` field from file content.
- Updated management API documentation with the new `type` field in auth files response.
This commit is contained in:
Luis Pater
2025-09-08 01:09:39 +08:00
parent 46fa32f087
commit c875088be2
8 changed files with 49 additions and 14 deletions

View File

@@ -168,6 +168,14 @@ func (w *Watcher) reloadConfig() {
w.config = newConfig
w.clientsMutex.Unlock()
// Always apply the current log level based on the latest config.
// This ensures logrus reflects the desired level even if change detection misses.
util.SetLogLevel(newConfig)
// Additional debug for visibility when the flag actually changes.
if oldConfig != nil && oldConfig.Debug != newConfig.Debug {
log.Debugf("log level updated - debug mode changed from %t to %t", oldConfig.Debug, newConfig.Debug)
}
// Log configuration changes in debug mode
if oldConfig != nil {
log.Debugf("config changes detected:")