-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Allow disabling of specific levels per-logger. #204
Allow disabling of specific levels per-logger. #204
Conversation
My team's usage of LumberJack had the following setup: - four loggers, `DDTTYLogger` and `DDFileLogger,` a crash logger, and an analytics logger - globally-defined ddLogLevel = `LOG_LEVEL_DEBUG` Our file logger is added with `LOG_LEVEL_INFO.` Our TTY logger is added with `LOG_LEVEL_DEBUG.` We use "INFO" events HEAVILY, as they are placed in the file logger and crash logger to help us know everything that happened leading up to a bug. As a requirement, The file logger CANNOT log DEBUG events. At the same time, because we have such a high volume of INFO events, it is challenging to see any of the `DEBUG` events in the TTY logger. We need to be configure our `DDTTYLogger` to at the DEBUG level, but omit `INFO` events. Essentially: `[DDLog addLogger:ttyLogger withLogLevel:(LOG_LEVEL_DEBUG & (~LOG_FLAG_INFO)];` However, this isn't possible in the current implementation of `+[DDLogger lt_log]` When iterating through registered loggers, `lt_log:` performs the check, "if (logMessage->logFlag > loggerNode.logLevel) continue;" Because our TTY logger's highest-set bit is `LOG_FLAG_DEBUG`, all info events are processed, even though we've unset the `LOG_FLAG_INFO` event. My proposed change configures `lt_log:` to examine whether a `DDLogMessage`'s specific `LOG_FLAG_..*` is set in `loggerNode->logLevel`.
Related to #203. Looks good to me. |
Fantastic. I'm really loving working with this framework. I think I'll have to dig deeper into the codebase... |
Allow disabling of specific levels per-logger.
Thanks for pulling this in! Do you happen to know when you plan to create the next .podspec? |
Should be soon, but in the mean time you can test it with the |
@matt-holden thanks for the patch this fixes the need for a custom formatter that we needed to assign per logger. |
In the case of Crashlytics there is already a logger available. |
@matt-holden the new version (1.8.0) of Lumberjack is available. |
Awesome! Sent from my iPhone
|
My team's usage of LumberJack had the following setup:
DDTTYLogger
andDDFileLogger,
a crash logger, and ananalytics logger
LOG_LEVEL_DEBUG
Our file logger is added with
LOG_LEVEL_INFO.
Our TTY logger is added with
LOG_LEVEL_DEBUG.
We use "INFO" events HEAVILY, as they are placed in the file logger and
crash logger to help us know everything that happened leading up to a
bug.
As a requirement, The file logger CANNOT log DEBUG events.
At the same time, because we have such a high volume of INFO events, it
is challenging to see any of the
DEBUG
events in the TTY logger.We need to be configure our
DDTTYLogger
to at the DEBUG level, but omitINFO
events.Essentially:
[DDLog addLogger:ttyLogger withLogLevel:(LOG_LEVEL_DEBUG & (~LOG_FLAG_INFO)];
However, this isn't possible in the current implementation of
+[DDLogger lt_log]
When iterating through registered loggers,
lt_log:
performs the check, "if (logMessage->logFlag > loggerNode.logLevel) continue;"
Because our TTY logger's highest-set bit is
LOG_FLAG_DEBUG
, all infoevents are processed, even though we've unset the
LOG_FLAG_INFO
event.My proposed change configures
lt_log:
to examine whether aDDLogMessage
'sspecific
LOG_FLAG_..*
is set inloggerNode->logLevel
.