Inherits from NSObject
Declared in DDLog.h

Overview

The DDLogMessage class encapsulates information about the log message. If you write custom loggers or formatters, you will be dealing with objects of this class.

Tasks

  • – initWithLogMsg:level:flag:context:file:function:line:tag:options:

    Standard init method for a log message object. Used by the logging primitives. (And the macros use the logging primitives.)

  • – threadID

    Returns the threadID as it appears in NSLog. That is, it is a hexadecimal value which is calculated from the machThreadID.

  • – fileName

    Convenience property to get just the file name, as the file variable is generally the full file path. This method does not include the file extension, which is generally unwanted for logging purposes.

  • – methodName

    Returns the function variable in NSString form.

Instance Methods

fileName

Convenience property to get just the file name, as the file variable is generally the full file path. This method does not include the file extension, which is generally unwanted for logging purposes.

- (NSString *)fileName

Discussion

Convenience property to get just the file name, as the file variable is generally the full file path. This method does not include the file extension, which is generally unwanted for logging purposes.

Declared In

DDLog.h

initWithLogMsg:level:flag:context:file:function:line:tag:options:

Standard init method for a log message object. Used by the logging primitives. (And the macros use the logging primitives.)

- (id)initWithLogMsg:(NSString *)logMsg level:(int)logLevel flag:(int)logFlag context:(int)logContext file:(const char *)file function:(const char *)function line:(int)line tag:(id)tag options:(DDLogMessageOptions)optionsMask

Discussion

Standard init method for a log message object. Used by the logging primitives. (And the macros use the logging primitives.)

If you find need to manually create logMessage objects, there is one thing you should be aware of:

If no flags are passed, the method expects the file and function parameters to be string literals. That is, it expects the given strings to exist for the duration of the object’s lifetime, and it expects the given strings to be immutable. In other words, it does not copy these strings, it simply points to them. This is due to the fact that FILE and FUNCTION are usually used to specify these parameters, so it makes sense to optimize and skip the unnecessary allocations. However, if you need them to be copied you may use the options parameter to specify this. Options is a bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction.

Declared In

DDLog.h

methodName

Returns the function variable in NSString form.

- (NSString *)methodName

Discussion

Returns the function variable in NSString form.

Declared In

DDLog.h

threadID

Returns the threadID as it appears in NSLog. That is, it is a hexadecimal value which is calculated from the machThreadID.

- (NSString *)threadID

Discussion

Returns the threadID as it appears in NSLog. That is, it is a hexadecimal value which is calculated from the machThreadID.

Declared In

DDLog.h