Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Use btclog for determining valid log levels.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jrick committed Jul 13, 2017
1 parent be12e06 commit ea5dc78
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea5dc78

Please sign in to comment.