SetLogLevel configures the logrus log level based on the configuration. It sets the log level to DebugLevel if debug mode is enabled, otherwise to InfoLevel.
(cfg *config.Config)
| 57 | // SetLogLevel configures the logrus log level based on the configuration. |
| 58 | // It sets the log level to DebugLevel if debug mode is enabled, otherwise to InfoLevel. |
| 59 | func SetLogLevel(cfg *config.Config) { |
| 60 | currentLevel := log.GetLevel() |
| 61 | var newLevel log.Level |
| 62 | if cfg.Debug { |
| 63 | newLevel = log.DebugLevel |
| 64 | } else { |
| 65 | newLevel = log.InfoLevel |
| 66 | } |
| 67 | |
| 68 | if currentLevel != newLevel { |
| 69 | log.SetLevel(newLevel) |
| 70 | log.Infof("log level changed from %s to %s (debug=%t)", currentLevel, newLevel, cfg.Debug) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // ResolveAuthDir normalizes the auth directory path for consistent reuse throughout the app. |
| 75 | // It expands a leading tilde (~) to the user's home directory and returns a cleaned path. |
no outgoing calls
no test coverage detected