I spent some time recently putting together a Cocoa interface to the built-in Apple System Logging (ASL) facility.
Following Peter Hosey’s excellent blog series on ASL and some other tidbits on Cocoa-Dev, I fashioned small and simple Cocoa framework for integrating ASL’s multi-leveled logging into your project.
—
#import <SOLogger/SOLogger.h>
SOLogger *logger;
logger = [SOLogger loggerForFacility: @"com.example.MyApp" options:ASL_OPT_STDERR];
[logger debug:@"A debugging note on: %@", [NSDate date]];
[logger info:@"We just did something."];
[logger notice:@"That's going to leave a mark"];
[logger warning:@"WTF?"];
[logger alert:@"WTF!"];
[logger critical:@"OMG"];
[logger panic:@"OMG WTF!"];
—
An interesting feature of SOLogger (courtesy of ASL) is that you can create separate loggers for subsystems in your code, potentially logging them to separate destinations.
I host the SOLogger project on Bitbucket with a BSD License.
Check it out.