DDMultiFormatter.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Software License Agreement (BSD License)
  2. //
  3. // Copyright (c) 2010-2021, Deusty, LLC
  4. // All rights reserved.
  5. //
  6. // Redistribution and use of this software in source and binary forms,
  7. // with or without modification, are permitted provided that the following conditions are met:
  8. //
  9. // * Redistributions of source code must retain the above copyright notice,
  10. // this list of conditions and the following disclaimer.
  11. //
  12. // * Neither the name of Deusty nor the names of its contributors may be used
  13. // to endorse or promote products derived from this software without specific
  14. // prior written permission of Deusty, LLC.
  15. #import <Foundation/Foundation.h>
  16. // Disable legacy macros
  17. #ifndef DD_LEGACY_MACROS
  18. #define DD_LEGACY_MACROS 0
  19. #endif
  20. #import <CocoaLumberjack/DDLog.h>
  21. NS_ASSUME_NONNULL_BEGIN
  22. /**
  23. * This formatter can be used to chain different formatters together.
  24. * The log message will processed in the order of the formatters added.
  25. **/
  26. @interface DDMultiFormatter : NSObject <DDLogFormatter>
  27. /**
  28. * Array of chained formatters
  29. */
  30. @property (nonatomic, readonly) NSArray<id<DDLogFormatter>> *formatters;
  31. /**
  32. * Add a new formatter
  33. */
  34. - (void)addFormatter:(id<DDLogFormatter>)formatter NS_SWIFT_NAME(add(_:));
  35. /**
  36. * Remove a formatter
  37. */
  38. - (void)removeFormatter:(id<DDLogFormatter>)formatter NS_SWIFT_NAME(remove(_:));
  39. /**
  40. * Remove all existing formatters
  41. */
  42. - (void)removeAllFormatters NS_SWIFT_NAME(removeAll());
  43. /**
  44. * Check if a certain formatter is used
  45. */
  46. - (BOOL)isFormattingWithFormatter:(id<DDLogFormatter>)formatter;
  47. @end
  48. NS_ASSUME_NONNULL_END