DittoLogger
public class DittoLogger
Class with static methods to customize the logging behavior from Ditto.
-
Represents whether logging is enabled.
Declaration
Swift
public static var enabled: Bool { get set }
-
The minimum log level at which logs will be logged, provided the logger is
enabled
.For example if this is set to
DittoLogLevel.warning
, then only logs that are logged with theWarning
orError
log levels will be shown.Declaration
Swift
public static var minimumLogLevel: DittoLogLevel { get set }
-
Represents whether or not emojis should be used as the log level indicator in the logs.
Declaration
Swift
public static var emojiLogLevelHeadingsEnabled: Bool { get set }
-
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
Swift
public static func setLogFile(_ logFile: String?)
Parameters
logFile
it 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
Swift
public static func setLogFileURL(_ logFile: URL?)
Parameters
logFile
it 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
Swift
public static func setCustomLogCallback(_ logCb: ((DittoLogLevel, String) -> ())?)
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).