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
initfor 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
messagethe message
levelthe log level
flagthe log flag
contextthe context (if any is defined)
filethe current file
functionthe current function
linethe current code line
tagpotential tag
optionsa bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction.
timestampthe 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 levelSwift
var level: DDLogLevel { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSInteger contextSwift
var context: Int { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *fileSwift
var file: String { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *fileNameSwift
var fileName: String { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSString * functionSwift
var function: String? { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSUInteger lineSwift
var line: UInt { get } -
Deprecated
Use representedObject instead
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) id tagSwift
var tag: Any? { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) id representedObjectSwift
var representedObject: Any? { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) DDLogMessageOptions optionsSwift
var options: DDLogMessageOptions { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSDate *timestampSwift
var timestamp: Date { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *threadIDSwift
var threadID: String { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSString *threadNameSwift
var threadName: String? { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSString *queueLabelSwift
var queueLabel: String { get } -
Undocumented
Declaration
Objective-C
@property (readonly, nonatomic) NSUInteger qosSwift
var qos: UInt { get }
View on GitHub
DDLogMessage Class Reference