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
Pass log context number to CocoaLumberjack if defined #315
Conversation
this would be a nice feature. |
So is the Log Context some indication of a log level specific to MagicalRecord? |
yes. The context can be used to identify logs coming from Magical Record as opposed to log coming from somewhere else. |
I guess the answer to your question is: somehow YES, but not what it seems. I should explain the current status and the effect of the change because you mention "log level" in a way that might lead to some confusion. MagicalRecord uses only one log level. Before and after this patch, if CocoaLumberjack is available, MagicalRecord will use the VERBOSE level, the most "noisy" of the default log levels (verbose, debug, warn, error). I have not changed the log level. Therefore after this patch will send logs with the same LEVEL However, CocoaLumberjack users can write their own filters and formatters. Every log message has a CONTEXT number. That way the formater or filter can identify the module/library sending that log. It does not change the log level, but allows the user to identify the origin of the log. Currently MagicalRecord is using the default context marker and that way it is not possible to identify the source of MagicalRecord logs. |
So, basically, the gist of this request is to allow for Cocoalumberjack to be able to filter out MagicalRecord logging for an app when the app includes MagicalRecord? Even though everything will eventually be verbose (which I think is ok for a framework/library... On Dec 13, 2012, at 9:42 AM, Francisco Garcia Rodriguez notifications@github.com wrote:
|
just as document for the future: I also thought about a second macro to define the default log level of MagicalRecord. However I rejected using that second macro because:
|
@casademora Yes, with my pull request Cocoalumberjack users will be able to filter/reformat MagicalRecord logs, even if they still are always verbose next time I will write better pull request descriptions. Lesson learned! |
Oh, the request is fine, its my and the team's lack of extra time that is making things slower than desired :( Thanks! On Dec 13, 2012, at 9:53 AM, Francisco Garcia Rodriguez notifications@github.com wrote:
|
Thanks! Just keep the great work. I am actually more concerned with other people not having a 2.0.9 release. There is a bug with 2.0.8 where saving a context does not always work but was solved immediately after on commit cfccd40. I guess that is upsetting people using only the master branch or cocoapods. I was surprised to see that it is taking so long to have a release with that bugfix. It is a wild world of annoying users out there. Please, just keep doing such a great library. |
Is this still a relevant change for users of CocoaLumberjack? |
yes, the current logging macro MRLog as defined now, calls CocoaLumberjack without any specific context number. Without that number, users customizing their logs output cannot identify which messages are sent by MagicalRecord. As mentioned above, my proposal still logs everything with the Verbose log level, but with a context number alone, it is possible to identify which logs are generated by MR MR does not generate logs with different levels, so it does not make sense implementing a more complex solution. |
I know Saul has been toying with this in the experimental branch — I’ll leave this in his capable hands (I don’t use CocoaLumberjack at the moment). |
Pass logging context number to CocoaLumberjack if defined
Since MagicalRecord already has some reference to CocoaLumberjack, I decided to add an optional context number.
If CocoaLumberjack is pressent and the user defines the macro MR_LOG_CONTEXT with a number, this will be used as the logging context id. That way the user can reformat/filter/control the logs coming from MagicalRecord