DDAbstractLogger Class Reference
Inherits from | NSObject |
Conforms to | DDLogger |
Declared in | DDLog.h |
Overview
The DDLogger protocol specifies that an optional formatter can be added to a logger. Most (but not all) loggers will want to support formatters.
However, writting 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 requiremenets: - 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!
Instance Methods
logFormatter
Formatters may optionally be added to any logger.
- (id<DDLogFormatter>)logFormatter
Discussion
Formatters may optionally be added to any logger.
If no formatter is set, the logger simply logs the message as it is given in logMessage, or it may use its own built in formatting style.
Declared In
DDLog.h