mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
allow to customize the log level
The old log-verbose flag is not appropriate anymore. You should now use the log-level flag to set your preferred log level. The default level is "debug" as before, you can also set "info", "warn", "error" Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -104,7 +104,7 @@ type Manager struct {
|
||||
}
|
||||
|
||||
// Initialize initializes the configured plugins
|
||||
func Initialize(configs []Config, logVerbose bool) error {
|
||||
func Initialize(configs []Config, logLevel string) error {
|
||||
logger.Debug(logSender, "", "initialize")
|
||||
Handler = Manager{
|
||||
Configs: configs,
|
||||
@@ -112,7 +112,7 @@ func Initialize(configs []Config, logVerbose bool) error {
|
||||
closed: 0,
|
||||
authScopes: -1,
|
||||
}
|
||||
setLogLevel(logVerbose)
|
||||
setLogLevel(logLevel)
|
||||
if len(configs) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -733,11 +733,16 @@ func (m *Manager) Cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
func setLogLevel(logVerbose bool) {
|
||||
if logVerbose {
|
||||
pluginsLogLevel = hclog.Debug
|
||||
} else {
|
||||
func setLogLevel(logLevel string) {
|
||||
switch logLevel {
|
||||
case "info":
|
||||
pluginsLogLevel = hclog.Info
|
||||
case "warn":
|
||||
pluginsLogLevel = hclog.Warn
|
||||
case "error":
|
||||
pluginsLogLevel = hclog.Error
|
||||
default:
|
||||
pluginsLogLevel = hclog.Debug
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user