fix: logLevel

This commit is contained in:
Richard Ramos 2023-02-24 11:58:49 -04:00
parent 65441f60e0
commit cedaa670c7
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import (
"sync"
"time"
golog "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p"
"go.uber.org/zap"
@ -129,6 +130,7 @@ func New(opts ...WakuNodeOption) (*WakuNode, error) {
if params.logger == nil {
params.logger = utils.Logger()
golog.SetAllLoggers(params.logLevel)
}
if params.privKey == nil {

View File

@ -58,7 +58,8 @@ type WakuNodeParameters struct {
wssPort int
tlsConfig *tls.Config
logger *zap.Logger
logger *zap.Logger
logLevel logging.LogLevel
noDefaultWakuTopic bool
enableRelay bool
@ -150,7 +151,8 @@ func WithLogger(l *zap.Logger) WakuNodeOption {
// WithLogLevel is a WakuNodeOption that sets the log level for go-waku
func WithLogLevel(lvl zapcore.Level) WakuNodeOption {
return func(params *WakuNodeParameters) error {
logging.SetAllLoggers(logging.LogLevel(lvl))
params.logLevel = logging.LogLevel(lvl)
logging.SetAllLoggers(params.logLevel)
return nil
}
}