DDLogFileFormatterDefault

Objective-C

@interface DDLogFileFormatterDefault : NSObject <DDLogFormatter>

Swift

class DDLogFileFormatterDefault : NSObject, DDLogFormatter

Most users will want file log messages to be prepended with the date and time. Rather than forcing the majority of users to write their own formatter, we will supply a logical default formatter. Users can easily replace this formatter with their own by invoking the setLogFormatter: method. It can also be removed by calling setLogFormatter:, and passing a nil parameter.

In addition to the convenience of having a logical default formatter, it will also provide a template that makes it easy for developers to copy and change.

  • Default initializer

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    convenience init()
  • Designated initializer, requires a date formatter

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDateFormatter:
        (nullable NSDateFormatter *)dateFormatter;

    Swift

    init(dateFormatter: DateFormatter?)