Bug fix: Logger was being set to NOOP despite no logger being provided when debug mode is turned on.
This commit is contained in:
parent
7b1f51a747
commit
49e3194ba0
1 changed files with 5 additions and 4 deletions
|
@ -250,7 +250,6 @@ func NewRealisClient(options ...ClientOption) (Realis, error) {
|
||||||
// Default configs
|
// Default configs
|
||||||
config.timeoutms = 10000
|
config.timeoutms = 10000
|
||||||
config.backoff = defaultBackoff
|
config.backoff = defaultBackoff
|
||||||
config.logger = LevelLogger{NoopLogger{}, false}
|
|
||||||
|
|
||||||
// Save options to recreate client if a connection error happens
|
// Save options to recreate client if a connection error happens
|
||||||
config.options = options
|
config.options = options
|
||||||
|
@ -260,13 +259,15 @@ func NewRealisClient(options ...ClientOption) (Realis, error) {
|
||||||
opt(config)
|
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, otherwise, set noop logger
|
||||||
|
|
||||||
// Set a logger if debug has been set to true but no logger has been set
|
|
||||||
if config.logger == nil && config.debug {
|
if config.logger == nil && config.debug {
|
||||||
config.logger = log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)
|
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.
|
//Set default Transport to JSON if needed.
|
||||||
if !config.jsonTransport && !config.binTransport {
|
if !config.jsonTransport && !config.binTransport {
|
||||||
config.jsonTransport = true
|
config.jsonTransport = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue