-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add WARN
, ERROR
and TRACE
log levels
#232
Conversation
config/logger/builtin-logger.go
Outdated
if len(args) != 0 { | ||
logWithArgs(l.level, l.loggerName, message, args...) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can save a lot of code by just using one log
method and checking len(args)
there. There's no need for logWith
and logWithout
because variadic args are not required (which is how they can have a zero length).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
config/logger/builtin-logger.go
Outdated
func (l *BuiltinMomentoLogger) Warn(message string, args ...string) { | ||
if l.level == WARN { | ||
momentoLog(l.level, l.loggerName, message, args...) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means a warning will not show up if the log level is set to a more detailed log level. For example, if the level is TRACE it won't log a warning.
This is easier if the log levels are defined as numbers in order of severity. Then it's if l.level >= WARN
.
WARN
,ERROR
andTRACE
log levelsMomentoLoggerFactory
'sGetLogger
to takelogLevel
to log correctly based on a requested log levelMomentoLogger
functions to log based on a requested log levelTRACE
logging when detecting an unrecognized response besidesDiscontinuity
,Item
, andHeartbeat
for topic subscriptionAlso
simple_cache_client.go
tocache_client.go
.Closes #157