From 31e4b1e24670d284d9530e5c200f5f8c01ea1e32 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 16 Dec 2024 16:27:09 +0000 Subject: [PATCH] this was already implemented for config --- log.go | 33 --------------------------------- rpcserver.go | 2 +- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/log.go b/log.go index bd2837a22..b6e205bd9 100644 --- a/log.go +++ b/log.go @@ -7,10 +7,8 @@ package main import ( "os" - "strings" "decred.org/dcrwallet/v5/chain" - "decred.org/dcrwallet/v5/errors" "decred.org/dcrwallet/v5/internal/loader" "decred.org/dcrwallet/v5/internal/loggers" "decred.org/dcrwallet/v5/internal/rpc/jsonrpc" @@ -85,37 +83,6 @@ func setLogLevels(logLevel string) { } } -// setLogLevelSpec sets all loggers, or a specific logger (when levelSpec is -// prefixed by the subsystem and an equals sign) to a particular log level. -func setLogLevelSpec(levelSpec string) error { - var subsys, level string - - equals := strings.Index(levelSpec, "=") - if equals != -1 { - subsys = levelSpec[:equals] - level = levelSpec[equals+1:] - } else { - level = levelSpec - } - - if subsys != "" { - if _, ok := subsystemLoggers[subsys]; !ok { - return errors.Errorf("subsystem %q does not exist", subsys) - } - } - - if _, ok := slog.LevelFromString(level); !ok { - return errors.Errorf("%q is not a valid log level", level) - } - - if subsys != "" { - setLogLevel(subsys, level) - } else { - setLogLevels(level) - } - return nil -} - // fatalf logs a message, flushes the logger, and finally exit the process with // a non-zero return code. func fatalf(format string, args ...any) { diff --git a/rpcserver.go b/rpcserver.go index 890c48370..2517cb802 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -242,7 +242,7 @@ func (rpcLoggers) Subsystems() []string { } func (rpcLoggers) SetLevels(levelSpec string) error { - return setLogLevelSpec(levelSpec) + return parseAndSetDebugLevels(levelSpec) } func startRPCServers(walletLoader *loader.Loader) (*grpc.Server, *jsonrpc.Server, error) {