mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
Use btclog for determining valid log levels.
This allows levels to be specified by their shorthand versions (CRIT vs CRITICAL, for example), works with any capitalization, and adds support for handling the OFF level (previously the least verbose log level that could be set was CRITICAL).
This commit is contained in:
parent
be12e0688b
commit
ea5dc78faf
18
config.go
18
config.go
@ -21,6 +21,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btclog"
|
||||
flags "github.com/btcsuite/go-flags"
|
||||
"github.com/btcsuite/go-socks/socks"
|
||||
"github.com/decred/dcrd/connmgr"
|
||||
@ -191,21 +192,8 @@ func cleanAndExpandPath(path string) string {
|
||||
|
||||
// validLogLevel returns whether or not logLevel is a valid debug log level.
|
||||
func validLogLevel(logLevel string) bool {
|
||||
switch logLevel {
|
||||
case "trace":
|
||||
fallthrough
|
||||
case "debug":
|
||||
fallthrough
|
||||
case "info":
|
||||
fallthrough
|
||||
case "warn":
|
||||
fallthrough
|
||||
case "error":
|
||||
fallthrough
|
||||
case "critical":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
_, ok := btclog.LevelFromString(logLevel)
|
||||
return ok
|
||||
}
|
||||
|
||||
// supportedSubsystems returns a sorted slice of the supported subsystems for
|
||||
|
||||
Loading…
Reference in New Issue
Block a user