Skip to content

Commit

Permalink
edit json format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Feb 19, 2023
1 parent f5496ac commit 9cf714b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [

[package]
name = "fast_log"
version = "1.5.52"
version = "1.5.53"
description = "Rust async log High-performance asynchronous logging"
readme = "Readme.md"
authors = ["ce <[email protected]>"]
Expand Down
12 changes: 3 additions & 9 deletions src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@ impl RecordFormat for FastLogFormat {
fn do_format(&self, arg: &mut FastLogRecord) {
match &arg.command {
Command::CommandRecord => {
let mut now = match self.time_type {
let now = match self.time_type {
TimeType::Local => {
fastdate::DateTime::from(arg.now).add_sub_sec(fastdate::offset_sec() as i64)
}
TimeType::Utc => fastdate::DateTime::from(arg.now),
}.to_string();
if now.len() < 27 {
let num = 27 - now.len();
for _ in 0..num {
now.push_str(" ");
}
}
if arg.level.to_level_filter() <= self.display_line_level {
arg.formated = format!(
"{} {} {}:{} {}\n",
"{:27} {} {}:{} {}\n",
&now,
arg.level,
arg.file,
Expand All @@ -46,7 +40,7 @@ impl RecordFormat for FastLogFormat {
);
} else {
arg.formated = format!(
"{} {} {} - {}\n",
"{:27} {} {} - {}\n",
&now, arg.level, arg.module_path, arg.args
);
}
Expand Down

0 comments on commit 9cf714b

Please sign in to comment.