DDLogMessage
Objective-C
@interface DDLogMessage : NSObject <NSCopying> {
NSString *_message;
DDLogLevel _level;
DDLogFlag _flag;
NSInteger _context;
NSString *_file;
NSString *_fileName;
NSString *_function;
NSUInteger _line;
id _representedObject;
DDLogMessageOptions _options;
NSDate *_timestamp;
NSString *_threadID;
NSString *_threadName;
NSString *_queueLabel;
NSUInteger _qos;
}
Swift
class DDLogMessage : NSObject, NSCopying
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.
-
Undocumented
Declaration
Objective-C
NSString *_message
-
Undocumented
Declaration
Objective-C
DDLogLevel _level
-
Undocumented
Declaration
Objective-C
DDLogFlag _flag
-
Undocumented
Declaration
Objective-C
NSInteger _context
-
Undocumented
Declaration
Objective-C
NSString *_file
-
Undocumented
Declaration
Objective-C
NSString *_fileName
-
Undocumented
Declaration
Objective-C
NSString *_function
-
Undocumented
Declaration
Objective-C
NSUInteger _line
-
Undocumented
Declaration
Objective-C
id _representedObject
-
Undocumented
Declaration
Objective-C
DDLogMessageOptions _options
-
Undocumented
Declaration
Objective-C
NSDate * _timestamp
-
Undocumented
Declaration
Objective-C
NSString *_threadID
-
Undocumented
Declaration
Objective-C
NSString *_threadName
-
Undocumented
Declaration
Objective-C
NSString *_queueLabel
-
Undocumented
Declaration
Objective-C
NSUInteger _qos
-
Default
init
for empty messages.Declaration
Objective-C
- (nonnull instancetype)init;
Swift
init()
-
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.
Declaration
Objective-C
- (nonnull instancetype)initWithMessage:(nonnull NSString *)message level:(DDLogLevel)level flag:(DDLogFlag)flag context:(NSInteger)context file:(nonnull NSString *)file function:(nullable NSString *)function line:(NSUInteger)line tag:(nullable id)tag options:(DDLogMessageOptions)options timestamp:(nullable NSDate *)timestamp;
Swift
init(message: String, level: DDLogLevel, flag: DDLogFlag, context: Int, file: String, function: String?, line: UInt, tag: Any?, options: DDLogMessageOptions = [], timestamp: Date?)
Parameters
message
the message
level
the log level
flag
the log flag
context
the context (if any is defined)
file
the current file
function
the current function
line
the current code line
tag
potential tag
options
a bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction.
timestamp
the log timestamp
Return Value
a new instance of a log message model object
-
The log message
Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull message;
Swift
var message: String { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) DDLogLevel level
Swift
var level: DDLogLevel { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSInteger context
Swift
var context: Int { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *file
Swift
var file: String { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *fileName
Swift
var fileName: String { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSString * function
Swift
var function: String? { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSUInteger line
Swift
var line: UInt { get }
-
Deprecated
Use representedObject instead
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) id tag
Swift
var tag: Any? { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) id representedObject
Swift
var representedObject: Any? { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) DDLogMessageOptions options
Swift
var options: DDLogMessageOptions { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSDate *timestamp
Swift
var timestamp: Date { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *threadID
Swift
var threadID: String { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSString *threadName
Swift
var threadName: String? { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *queueLabel
Swift
var queueLabel: String { get }
-
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSUInteger qos
Swift
var qos: UInt { get }