diff --git a/realis.go b/realis.go index f1cb09f..a697a60 100644 --- a/realis.go +++ b/realis.go @@ -250,7 +250,6 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { // Default configs config.timeoutms = 10000 config.backoff = defaultBackoff - config.logger = LevelLogger{NoopLogger{}, false} // Save options to recreate client if a connection error happens config.options = options @@ -260,13 +259,15 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { opt(config) } - config.logger.Println("Number of options applied to config: ", len(options)) - - // Set a logger if debug has been set to true but no logger has been set + // Set a logger if debug has been set to true but no logger has been set, otherwise, set noop logger if config.logger == nil && config.debug { config.logger = log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC) + } else if config.logger == nil { + config.logger = LevelLogger{NoopLogger{}, false} } + config.logger.Println("Number of options applied to config: ", len(options)) + //Set default Transport to JSON if needed. if !config.jsonTransport && !config.binTransport { config.jsonTransport = true