LogConfiguration
public struct LogConfiguration
Represents the configuration of the logging framework
-
Reference to an external log writer object. If this property is set, all other properties are ignored and all log output will be sent to the external log writer
Declaration
Swift
public let externalWriter: LogWriter?
-
The full path to the log output file. If rotation is enabled, rotated logs will take this name but insert a number in between the name and the file extension. If no file extension is specified, .log will be used
Declaration
Swift
public let fileUrl: URL
-
If set, log file writes and rotation operations are performed on a background queue. Else, writes are performed synchronously inline with the caller, and dispatch_sync is used. Defaults to true
Declaration
Swift
public let async: Bool
-
Formatter function which produces the output string
Declaration
Swift
public let formatter: LogFormatter
-
If set, file writes will always be flushed using NSFileHandle -synchronizeFile. Else, they won’t. Defaults to true
Declaration
Swift
public let alwaysFlush: Bool
-
If set, the log will rotate when it reaches this size (in bytes). If not set, logs won’t be rotated based on size.
Declaration
Swift
public let rotationFileSize: Int?
-
If set, the log will rotate if it survives this long (without being rotated due to file size). Else, logs won’t be rotated based on time public let rotationInterval:NSTimeInterval? If set, after rotation if there are more than this number of log files (including the base one), the oldest file will be deleted. Else, all logs will be kept (dangerous!)
Declaration
Swift
public let rotationKeepCount: Int?
-
The text encoding used. Defaults to utf8
Declaration
Swift
public let fileEncoding: String.Encoding
-
inits a LogConfiguration which will cause log messages to be written to a file
Declaration
Swift
public init( fileUrl: URL, // this one is mandatory formatter: LogFormatter? = nil, async: Bool = true, rotationFileSize: Int? = nil, rotationKeepCount: Int? = nil, fileEncoding: String.Encoding = String.Encoding.utf8, alwaysFlush: Bool = true)