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
defaultUsePlaintext
Declaration
Swift
public let usePlaintext: Bool
-
The maximum size of a log file before being rotated in bytes. The default is
defaultMaxKeptFiles
Declaration
Swift
public let maxKeptFiles: Int32
-
The max number of rotated log files to keep. The default value is
defaultMaxSize
Declaration
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
level
The minimum log level for messages to be logged.
directory
The directory where the log files will be stored.
usePlainText
An optional flag indicating whether to use plain text format for the log files. Default is using the binary format.
maxKeptFiles
An optional maximum number of rotated log files to keep. Default is
defaultMaxKeptFiles
.maxFileSize
An 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