pub fn set_log_path(config: LogConfig)
Expand description
Sets the log path and, optionally, the log rotator configuration.
This function takes a LogConfig
argument that specifies the log path and, optionally,
the log rotator configuration. If a log rotator configuration is provided, the log rotator
will automatically rotate the logs when necessary based on the provided configuration.
§Arguments
config
- The log configuration. Can be either aLogConfig::Path
variant that specifies the log path or aLogConfig::Rotator
variant that specifies the log path and the log rotator configuration.
§Examples
§Set the log path without a log rotator:
use logger_rust::*;
use std::time::Duration;
use std::path::PathBuf;
set_log_level(LogLevel::File);
set_log_path(LogConfig::Path(LogPath::from("C:/Users/qruie/Documents")));
§Set the log path with a log rotator
use logger_rust::*;
use std::time::Duration;
use std::path::PathBuf;
set_log_level(LogLevel::File);
set_log_path(LogConfig::Rotator(LogRotatorConfig::new(
PathBuf::from("C:/Users/qruie/Documents"),
5 * 1024 * 1024,
Duration::from_secs(2),
)));