pub struct Config {
pub write_level: Level,
pub print_level: Level,
pub directory: String,
pub file_prefix: Option<String>,
pub size_limit: Option<u64>,
pub duration_limit: Option<u64>,
}Expand description
Configuration for the logger.
Fields§
§write_level: LevelThe level that the logger will accept for writing to a file.
Default: Level::Info
print_level: LevelThe level that the logger will accept for printing to the console.
Default: Level::Info
directory: StringThe directory where the log files will be stored. The directory along with prefix will be used
as a key for getting the writer. If 2 logger having same directory and file_prefix, the writer
will be the same one regardless of if limits are different. This is to prevent multiple writers
working on the same file.
Default: ./logs
file_prefix: Option<String>The prefix of the log file. The log file will be named as {prefix} {date}_{time}.log.
If the field is None, the log file will be named as {date}_{time}.log. Error of unable to
create the log file with the unsupported character in prefix is not handled.
If one logger having no prefix, size_limit and duration_limit the file name will always
be log.log.
Default: None
size_limit: Option<u64>The size limit in bytes of the log file. When the file size exceeds this limit, the file will be rotated. If the 0 is set, the file will never be rotated by size.
Default: 10 * 1024 * 1024
duration_limit: Option<u64>The duration limit in seconds of the log file. When the file duration exceeds this limit, the file will be rotated. If the 0 is set, the file will never be rotated by duration.