DITLogger

@interface DITLogger : NSObject

Class with static methods to customize the logging behavior from Ditto.

  • Whether the logger is currently enabled.

    Declaration

    Objective-C

    @property (class, nonatomic) BOOL enabled;
  • The minimum log level at which logs will be logged.

    For example if this is set to DITLogLevel.Warning, then only logs that are logged with the Warning or Error log levels will be shown.

    Declaration

    Objective-C

    @property (class, nonatomic) enum DITLogLevel minimumLogLevel;
  • Represents whether or not emojis should be used as the log level indicator in the logs.

    Declaration

    Objective-C

    @property (class, nonatomic) BOOL emojiLogLevelHeadingsEnabled;
  • Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console).

    Declaration

    Objective-C

    + (void)setLogFile:(nullable NSString *)logFile;

    Parameters

    logFile

    can be nil, in which case the current logging file, if any, is unregistered, otherwise, the file path must be within an already existing directory.

  • Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console).

    Declaration

    Objective-C

    + (void)setLogFileURL:(nullable NSURL *)logFile;

    Parameters

    logFile

    can be nil, in which case the current logging file, if any, is unregistered, otherwise, the file path must be within an already existing directory.

  • Registers a callback for a fully customizable way of handling log “events” from the logger (on top of logging to the console, and to a file, if any).

    Declaration

    Objective-C

    + (void)setCustomLogCallback:(nullable void (^)(enum DITLogLevel,
                                                    NSString *_Nonnull))logCallback;

    Parameters

    logCallback

    a block that can be nil, in which case the current callback, if any, is unregistered. Otherwise it is called each time a log statement is issued by Ditto (after filtering by log level), which can happen in parallel; the block must thus be thread-safe.