feat(zlog)!: JSON logging support
This commit is contained in:
parent
01c3699d86
commit
e347fe6d54
5 changed files with 162 additions and 12 deletions
|
@ -12,6 +12,11 @@ pub struct LoggerConfig {
|
|||
pub(crate) stdout_include_time: bool,
|
||||
pub(crate) file_include_time: bool,
|
||||
pub(crate) crate_max_level: Option<LogLevel>,
|
||||
pub(crate) log_use_json: bool,
|
||||
pub(crate) log_json_show_timestamp: bool,
|
||||
pub(crate) log_json_show_level: bool,
|
||||
pub(crate) log_json_show_message: bool,
|
||||
pub(crate) log_json_show_additional_fields: bool,
|
||||
}
|
||||
|
||||
impl LoggerConfig {
|
||||
|
@ -49,6 +54,31 @@ impl LoggerConfig {
|
|||
self.file_include_time = i;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn log_use_json(mut self, i: bool) -> Self {
|
||||
self.log_use_json = i;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn log_json_show_timestamp(mut self, i: bool) -> Self {
|
||||
self.log_json_show_timestamp = i;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn log_json_show_level(mut self, i: bool) -> Self {
|
||||
self.log_json_show_level = i;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn log_json_show_message(mut self, i: bool) -> Self {
|
||||
self.log_json_show_message = i;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn log_json_show_additional_fields(mut self, i: bool) -> Self {
|
||||
self.log_json_show_additional_fields = i;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for LoggerConfig {
|
||||
|
@ -62,6 +92,11 @@ impl Default for LoggerConfig {
|
|||
stdout_color: true,
|
||||
stdout_include_time: false,
|
||||
file_include_time: false,
|
||||
log_use_json: false,
|
||||
log_json_show_timestamp: false,
|
||||
log_json_show_level: false,
|
||||
log_json_show_message: false,
|
||||
log_json_show_additional_fields: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue