AWSDDAbstractLogger

Objective-C

@interface AWSDDAbstractLogger : NSObject <AWSDDLogger> {
  id<AWSDDLogFormatter> _Nullable _logFormatter;
  dispatch_queue_t _loggerQueue;
}

Swift

class AWSDDAbstractLogger : NSObject, AWSDDLogger

The AWSDDLogger protocol specifies that an optional formatter can be added to a logger. Most (but not all) loggers will want to support formatters.

However, writing getters and setters in a thread safe manner, while still maintaining maximum speed for the logging process, is a difficult task.

To do it right, the implementation of the getter/setter has strict requirements:

  • Must NOT require the logMessage: method to acquire a lock.
  • Must NOT require the logMessage: method to access an atomic property (also a lock of sorts).

To simplify things, an abstract logger is provided that implements the getter and setter.

Logger implementations may simply extend this class, and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their logMessage: method!

  • Undocumented

    Declaration

    Objective-C

    _Nullable id <AWSDDLogFormatter> _logFormatter
  • Undocumented

    Declaration

    Objective-C

    dispatch_queue_t _loggerQueue
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id <AWSDDLogFormatter> logFormatter

    Swift

    var logFormatter: AWSDDLogFormatter? { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue

    Swift

    var loggerQueue: DispatchQueue { get set }
  • Return YES if the current logger uses a global queue for logging

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isOnGlobalLoggingQueue) BOOL onGlobalLoggingQueue;

    Swift

    var isOnGlobalLoggingQueue: Bool { get }
  • Return YES if the current logger uses the internal designated queue for logging

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isOnInternalLoggerQueue) BOOL onInternalLoggerQueue;

    Swift

    var isOnInternalLoggerQueue: Bool { get }