ContextFilterLogFormatter.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #import <Foundation/Foundation.h>
  2. #import "DDLog.h"
  3. @class ContextFilterLogFormatter;
  4. /**
  5. * Welcome to Cocoa Lumberjack!
  6. *
  7. * The project page has a wealth of documentation if you have any questions.
  8. * https://github.com/robbiehanson/CocoaLumberjack
  9. *
  10. * If you're new to the project you may wish to read the "Getting Started" page.
  11. * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
  12. *
  13. *
  14. * This class provides a log formatter that filters log statements from a logging context not on the whitelist.
  15. *
  16. * A log formatter can be added to any logger to format and/or filter its output.
  17. * You can learn more about log formatters here:
  18. * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomFormatters
  19. *
  20. * You can learn more about logging context's here:
  21. * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomContext
  22. *
  23. * But here's a quick overview / refresher:
  24. *
  25. * Every log statement has a logging context.
  26. * These come from the underlying logging macros defined in DDLog.h.
  27. * The default logging context is zero.
  28. * You can define multiple logging context's for use in your application.
  29. * For example, logically separate parts of your app each have a different logging context.
  30. * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
  31. **/
  32. @interface ContextWhitelistFilterLogFormatter : NSObject <DDLogFormatter>
  33. - (id)init;
  34. - (void)addToWhitelist:(int)loggingContext;
  35. - (void)removeFromWhitelist:(int)loggingContext;
  36. - (NSArray *)whitelist;
  37. - (BOOL)isOnWhitelist:(int)loggingContext;
  38. @end
  39. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. #pragma mark -
  41. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  42. /**
  43. * This class provides a log formatter that filters log statements from a logging context on the blacklist.
  44. **/
  45. @interface ContextBlacklistFilterLogFormatter : NSObject <DDLogFormatter>
  46. - (id)init;
  47. - (void)addToBlacklist:(int)loggingContext;
  48. - (void)removeFromBlacklist:(int)loggingContext;
  49. - (NSArray *)blacklist;
  50. - (BOOL)isOnBlacklist:(int)loggingContext;
  51. @end