CustomFormattersAppDelegate.m 1002 B

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