MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / SetLogLevel

Function SetLogLevel

internal/util/util.go:59–72  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
59func 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.

Callers 4

reloadConfigMethod · 0.92
UpdateClientsMethod · 0.92
mainFunction · 0.92
logHomeConfigChangesFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected