Replace logging backend to log4rs and add log rotation (#1789)
* Replace logging backend to flexi-logger and add log rotation * Changed flexi_logger to log4rs * Disable logging level filtering in Root logger * Support different logging levels for file and stdout * Don't log messages from modules other than Grin-related * Fix formatting * Place backed up compressed log copies into log file directory * Increase default log file size to 16 MiB * Add comment to config file on log_max_size option
This commit is contained in:
+4
-3
@@ -14,11 +14,9 @@
|
||||
|
||||
//! Logging configuration types
|
||||
|
||||
/// Log level types, as slog's don't implement serialize
|
||||
/// Log level types
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub enum LogLevel {
|
||||
/// Critical
|
||||
Critical,
|
||||
/// Error
|
||||
Error,
|
||||
/// Warning
|
||||
@@ -46,6 +44,8 @@ pub struct LoggingConfig {
|
||||
pub log_file_path: String,
|
||||
/// Whether to append to log or replace
|
||||
pub log_file_append: bool,
|
||||
/// Size of the log in bytes to rotate over (optional)
|
||||
pub log_max_size: Option<u64>,
|
||||
/// Whether the tui is running (optional)
|
||||
pub tui_running: Option<bool>,
|
||||
}
|
||||
@@ -59,6 +59,7 @@ impl Default for LoggingConfig {
|
||||
file_log_level: LogLevel::Debug,
|
||||
log_file_path: String::from("grin.log"),
|
||||
log_file_append: true,
|
||||
log_max_size: Some(1024 * 1024 * 16), // 16 megabytes default
|
||||
tui_running: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user