CustomFormattersAppDelegate.m 901 B

12345678910111213141516171819202122232425262728293031323334
  1. #import "CustomFormattersAppDelegate.h"
  2. #import <CocoaLumberjack/CocoaLumberjack.h>
  3. #import "TestFormatter.h"
  4. // Debug levels: off, error, warn, info, verbose
  5. static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
  6. @implementation CustomFormattersAppDelegate
  7. @synthesize window;
  8. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  9. {
  10. // Setup logging (with our custom formatter)
  11. TestFormatter *formatter = [[TestFormatter alloc] init];
  12. [[DDASLLogger sharedInstance] setLogFormatter:formatter];
  13. [[DDTTYLogger sharedInstance] setLogFormatter:formatter];
  14. [DDLog addLogger:[DDASLLogger sharedInstance]];
  15. [DDLog addLogger:[DDTTYLogger sharedInstance]];
  16. // Log some messages
  17. DDLogError(@"Paper Jam!");
  18. DDLogWarn(@"Low toner");
  19. DDLogInfo(@"Printing SalesProjections.doc");
  20. DDLogVerbose(@"Warming up toner");
  21. }
  22. @end