FileLogSink
public struct FileLogSink
A log sink that writes log messages to files.
-
The minimum log level of the log messages to be logged.
Declaration
Swift
public let level: LogLevel -
The directory where the log files will be stored.
Declaration
Swift
public let directory: String -
To use plain text file format instead of the default binary format. The default is
defaultUsePlaintextDeclaration
Swift
public let usePlaintext: Bool -
The maximum size of a log file before being rotated in bytes. The default is
defaultMaxKeptFilesDeclaration
Swift
public let maxKeptFiles: Int32 -
The max number of rotated log files to keep. The default value is
defaultMaxSizeDeclaration
Swift
public let maxFileSize: Int64 -
Initializes a FileLogSink with the specified log level, directory, and optional parameters.
Declaration
Swift
public init(level: LogLevel, directory: String, usePlainText: Bool = defaultUsePlaintext, maxKeptFiles: Int32 = defaultMaxKeptFiles, maxFileSize: Int64 = defaultMaxSize)Parameters
levelThe minimum log level for messages to be logged.
directoryThe directory where the log files will be stored.
usePlainTextAn optional flag indicating whether to use plain text format for the log files. Default is using the binary format.
maxKeptFilesAn optional maximum number of rotated log files to keep. Default is
defaultMaxKeptFiles.maxFileSizeAn optional maximum size of a log file before being rotated in bytes. Default is
defaultMaxSize. -
[false] Plaintext is not used, and instead binary encoding is used in log files
Declaration
Swift
static let defaultUsePlaintext: Bool -
[2] 2 files preserved during each log rotation
Declaration
Swift
static let defaultMaxKeptFiles: Int32 -
[524288] 512 KiB for the size of a log file
Declaration
Swift
static let defaultMaxSize: Int64
FileLogSink Structure Reference