YDBLogMessage

@interface YDBLogMessage : NSObject

Ecapsulates detailed information about an emitted log message.

  • Standard init method

    Declaration

    Objective-C

    - (nonnull instancetype)initWithMessage:(nonnull NSString *)message
                                      level:(YDBLogLevel)level
                                       flag:(YDBLogFlag)flag
                                       file:(nonnull NSString *)file
                                   function:(nonnull NSString *)function
                                       line:(NSUInteger)line;

    Swift

    init(message: String, level: YDBLogLevel, flag: YDBLogFlag, file: String, function: String, line: UInt)
  • The log message. (e.g. sqlite failed to do X because Y)

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull message;

    Swift

    var message: String { get }
  • The configured ydbLogLevel of the file from which the log was emitted.

    Declaration

    Objective-C

    @property (readonly, nonatomic) YDBLogLevel level;

    Swift

    var level: YDBLogLevel { get }
  • Tells you which flag triggered the log. For example, if flag == YDBLogFlagError, then this is an error log message, emitted via YDBLogError()

    Declaration

    Objective-C

    @property (readonly, nonatomic) YDBLogFlag flag;

    Swift

    var flag: YDBLogFlag { get }
  • The full filePath (e.g. /Users/alice/code/myproject/YapDatabase/Extensions/YapFooBarTransaction.m) This comes from __FILE__

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull file;

    Swift

    var file: String { get }
  • The lastPathComponent of the filePath, with the fileExtension removed. (e.g. YapFooBarTransaction)

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull fileName;

    Swift

    var fileName: String { get }
  • The name of function that triggered the log message. This comes from PRETTY_FUNCTION

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull function;

    Swift

    var function: String { get }
  • The line number within the file. (i.e. location of emitted log message)

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger line;

    Swift

    var line: UInt { get }