-
Notifications
You must be signed in to change notification settings - Fork 571
Tips and tricks
Filters allow you to match entries containing text that matches regular expressions. For this, your filter must use the matches
clause and you should bracket your regex with .*
on both sides of the text, like in the example below.
When debugging software, one frequently needs to set marks in the log at various points to identify action sections (for example, place a mark in the log before pushing a button, to visualize the logs generated by the button action). To this end, NSLogger allows you to add a mark at the end of the log. Select Add Mark
(Cmd-M) in the action menu at bottom of the window to quickly add a time-stamped mark. Use Add Mark With Title
(shift-Cmd-M) to customize the title that will appear in the log window.
To have NSLogger getting started too when your app gets started just enter ‘Edit Scheme’ and add a ‘Run Script’ to the ‘Pre-Actions’ of ‘Run’. The script to run should look like this:
open -g -a NSLogger
If you want to start not only for specific projects you may want to have a look at the very powerful ‘Behaviours’.
When working in a team you need to take care that logs would be transmitted only to your machine. To set everything up:
- Add to the ‘Preprocessor Macros’ in the project’s build settings. Make sure to add it only for debug mode. It creates a constant
LOGGER_TARGET=@\"$(USER)\"
LOGGER_TARGET
that contains your current (short) username.
- Add these lines in
application:didFinishLaunchingWithOptions:
:
#ifdef LOGGER_TARGET LoggerSetupBonjour(NULL, NULL, (CFStringRef)LOGGER_TARGET); #endif
This configures the default logger to send messages to bonjour service namedLOGGER_TARGET
.
- In the NSLogger application preferences set bonjour service name to your current username.