-
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
Create ASL capture module. #242
Conversation
…he Lumberjack framework as it's not yet clear the best way to do so.
// TODO: We have some options here. One is to call the corresponding DDLog macros based on the log level. However | ||
// we won't get the timestamp of the original NSLog there, which is an important piece of information. Alternatively | ||
// we will have to create a DDLogMessage object and set the timestamp directly, but there is no DDLog interface for | ||
// accepting a DDLogMessage. |
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.
Manually creating the log message is the best choice, we can then make + (void)queueLogMessage:(DDLogMessage *)logMessage asynchronously:(BOOL)asyncFlag
public and use it.
Alternatively we could add a timestamp
parameter to the DDLogMessage
's init, and set it no the current time if no timestamp is set.
* Add new init method too DDLogMessage which takes in a timestamp * Make DDLog queueLogMessage:asynchronously: public * Add nanoseconds to ASL capture timestamps * Adjust some logging levels. * TODO: Need to figure out how to get ddLogLevel into the ASLLogCapture module so it can be passed to the DDLogMessage init method. Perhaps declare it as extern in DDLog.h?
Hi Ernesto. I've pushed a new commit where I'm calling DDLog queueLogMessage:asynchronously: with a DDLogMessage initialized with the NSLog contents. There are a couple of things left to do which I'm not quite comfortable doing:
Thanks, |
Maybe a new higher level
We could let the user choose by changing the
Tag is for now simply ignored so we can use that. I can do a separate pull request for this and in the mean time just the ASL logger should be skipped when capturing ASL logs.
We can do that or you could implement it as all
Maybe to keep it simple we could have a separate Thanks to you! Looking forward to start using it ;) |
* Allow client to specify whether ASL logs get dispatched synchronously or asynchronously
Hi Ernesto. I've just pushed another commit which integrates your suggestions for items 2 and 4. For item 1, I'm not clear exactly how that would help as DDLog.m still doesn't have access to ddLogLevel. I'll leave items 1 and 3 up to you. For item 5, I've decided to leave it and use allow all ASL Log messages to be captured and allow the framework to filter. |
Sure. I'll try to address the remaining points. Thanks again! |
Capture ASL
Pull request with your changes included. |
@Diarrhio does it work well for your usages? @bpoplauschi what do you think about using |
Yup. |
Ok, merging this myself. Let's try to use |
Create ASL capture module.
@rivera-ernesto: I just saw the question about About testing, I think we lack some good unit tests that we can run after a big change like this or before a release. Will add that to our 2.0 list. |
I've done some preliminary tests with :head and things seem to be working well. Will file an issue if I find anything. |
@Diarrhio One last thing before making a release. There's an Analyzer warning here.
int notifyToken; // Can be used to unregister with notify_cancel(). // <- We need to set a default value here!
notify_register_dispatch(kNotifyASLDBUpdate, ¬ifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(int token)
{
// At least one message has been posted; build a search query.
@autoreleasepool
{
// ...
if(_cancel)
{
notify_cancel(notifyToken);
return;
}
}
}); |
Silenced the warning just by setting |
A number of notes: