diff --git a/default_config.toml b/default_config.toml index be92f1e..afa8ae0 100644 --- a/default_config.toml +++ b/default_config.toml @@ -1,6 +1,7 @@ message_keys = ["short_message", "msg", "message"] time_keys = ["timestamp", "time", "@timestamp"] dump_all_exclude = [] +always_print_fields = [] level_keys = ["level", "severity", "log.level", "loglevel"] main_line_format = "{{bold(fixed_size 19 fblog_timestamp)}} {{level_style (uppercase (fixed_size 5 fblog_level))}}:{{#if fblog_prefix}} {{bold(cyan fblog_prefix)}}{{/if}} {{fblog_message}}" additional_value_format = "{{bold (color_rgb 150 150 150 (fixed_size 25 key))}}: {{value}}" diff --git a/src/config.rs b/src/config.rs index 8e19c6e..060e311 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,10 +12,15 @@ fn default_message_keys() -> Vec { fn default_time_keys() -> Vec { vec!["timestamp".to_string(), "time".to_string(), "@timestamp".to_string()] } + fn default_dump_all_exclude() -> Vec { vec![] } +fn default_always_print_fields() -> Vec { + vec![] +} + fn default_level_keys() -> Vec { vec!["level".to_string(), "severity".to_string(), "log.level".to_string(), "loglevel".to_string()] } @@ -43,6 +48,9 @@ pub struct Config { #[serde(default = "default_dump_all_exclude")] pub dump_all_exclude: Vec, + #[serde(default = "default_always_print_fields")] + pub always_print_fields: Vec, + #[serde(default = "default_level_keys")] pub level_keys: Vec, @@ -87,6 +95,7 @@ impl Config { main_line_format: default_main_line_format(), additional_value_format: default_additional_value_format(), dump_all_exclude: default_dump_all_exclude(), + always_print_fields: default_always_print_fields(), } } diff --git a/src/log_settings.rs b/src/log_settings.rs index ec0227d..faa06d4 100644 --- a/src/log_settings.rs +++ b/src/log_settings.rs @@ -21,7 +21,7 @@ impl LogSettings { time_keys: config.time_keys.clone(), level_keys: config.level_keys.clone(), level_map: config.level_map.clone(), - additional_values: vec![], + additional_values: config.always_print_fields.clone(), excluded_values: config.dump_all_exclude.clone(), dump_all: false, with_prefix: false,