Inherits from NSObject
Declared in DDLog.h

Tasks

Class Methods

addLogger:

+ (void)addLogger:(id<DDLogger>)logger
Discussion

Adds the logger to the system.

This is equivalent to invoking [DDLog addLogger:logger withLogLevel:DDLogLevelAll].

Declared In

DDLog.h

addLogger:withLevel:

+ (void)addLogger:(id<DDLogger>)logger withLevel:(DDLogLevel)level
Discussion

Adds the logger to the system.

The level that you provide here is a preemptive filter (for performance). That is, the level specified here will be used to filter out logMessages so that the logger is never even invoked for the messages.

More information: When you issue a log statement, the logging framework iterates over each logger, and checks to see if it should forward the logMessage to the logger. This check is done using the level parameter passed to this method.

For example:

[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose]; [DDLog addLogger:fileLogger withLogLevel:DDLogLevelWarning];

DDLogError(@“oh no”); => gets forwarded to consoleLogger & fileLogger DDLogInfo(@“hi”); => gets forwarded to consoleLogger only

It is important to remember that Lumberjack uses a BITMASK. Many developers & third party frameworks may define extra log levels & flags. For example:

define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0…1000000

So if you specify DDLogLevelVerbose to this method, you won’t see the framework’s trace messages.

(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO

Consider passing DDLogLevelAll to this method, which has all bits set. You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set, except the ones you explicitly don’t want. For example, if you wanted everything except verbose & debug:

((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)

Declared In

DDLog.h

allLoggers

+ (NSArray *)allLoggers

flushLog

+ (void)flushLog
Discussion

Since logging can be asynchronous, there may be times when you want to flush the logs. The framework invokes this automatically when the application quits.

Declared In

DDLog.h

levelForClass:

+ (DDLogLevel)levelForClass:(Class)aClass

levelForClassWithName:

+ (DDLogLevel)levelForClassWithName:(NSString *)aClassName

log:level:flag:context:file:function:line:tag:format:

+ (void)log:(BOOL)synchronous level:(DDLogLevel)level flag:(DDLogFlag)flag context:(NSInteger)context file:(const char *)file function:(const char *)function line:(NSUInteger)line tag:(id)tag format:(NSString *)format, ...
Discussion

Logging Primitive.

This method is used by the macros above. It is suggested you stick with the macros as they’re easier to use.

Declared In

DDLog.h

log:level:flag:context:file:function:line:tag:format:args:

+ (void)log:(BOOL)asynchronous level:(DDLogLevel)level flag:(DDLogFlag)flag context:(NSInteger)context file:(const char *)file function:(const char *)function line:(NSUInteger)line tag:(id)tag format:(NSString *)format args:(va_list)argList
Discussion

Logging Primitive.

This method can be used if you have a prepared va_list.

Declared In

DDLog.h

log:message:

+ (void)log:(BOOL)asynchronous message:(DDLogMessage *)logMessage
Discussion

Logging Primitive.

This method can be used if you manualy prepared DDLogMessage.

Declared In

DDLog.h

log:message:level:flag:context:file:function:line:tag:

+ (void)log:(BOOL)asynchronous message:(NSString *)message level:(DDLogLevel)level flag:(DDLogFlag)flag context:(NSInteger)context file:(const char *)file function:(const char *)function line:(NSUInteger)line tag:(id)tag
Discussion

Logging Primitive.

Declared In

DDLog.h

loggingQueue

+ (dispatch_queue_t)loggingQueue
Discussion

Provides access to the underlying logging queue. This may be helpful to Logger classes for things like thread synchronization.

Declared In

DDLog.h

registeredClassNames

+ (NSArray *)registeredClassNames

registeredClasses

+ (NSArray *)registeredClasses
Discussion

Registered Dynamic Logging

These methods allow you to obtain a list of classes that are using registered dynamic logging, and also provides methods to get and set their log level during run time.

Declared In

DDLog.h

removeAllLoggers

+ (void)removeAllLoggers

removeLogger:

+ (void)removeLogger:(id<DDLogger>)logger

setLevel:forClass:

+ (void)setLevel:(DDLogLevel)level forClass:(Class)aClass

setLevel:forClassWithName:

+ (void)setLevel:(DDLogLevel)level forClassWithName:(NSString *)aClassName