time format is now with T separator
This commit is contained in:
parent
c803fcccbf
commit
e28bd11aeb
1 changed files with 11 additions and 6 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -136,13 +136,14 @@ fn init_logger(
|
|||
app_log_path: Option<&Path>,
|
||||
stat_log_path: Option<&Path>,
|
||||
) -> Result<(), fern::InitError> {
|
||||
|
||||
let log_level = match verbosity {
|
||||
0 => LevelFilter::Info,
|
||||
1 => LevelFilter::Debug,
|
||||
_ => LevelFilter::Trace,
|
||||
};
|
||||
|
||||
let time_format_string = "%Y-%m-%dT%H:%M:%S%.3f";
|
||||
|
||||
let app_dispatch = app_log_path.map(|path| {
|
||||
Dispatch::new()
|
||||
.format(|out, message, record| {
|
||||
|
|
@ -150,7 +151,7 @@ fn init_logger(
|
|||
let message = message.to_string();
|
||||
out.finish(format_args!(
|
||||
"{} [{}] - {}",
|
||||
now.format("%Y-%m-%d %H:%M:%S%.3f"),
|
||||
now.format(time_format_string),
|
||||
record.level(),
|
||||
if record.target() == "stats10min" {
|
||||
Stats10Min::nice_log_format(&message)
|
||||
|
|
@ -171,7 +172,7 @@ fn init_logger(
|
|||
let now = Local::now();
|
||||
out.finish(format_args!(
|
||||
"{} {}",
|
||||
now.format("%Y-%m-%d %H:%M:%S%.3f"),
|
||||
now.format(time_format_string),
|
||||
message
|
||||
))
|
||||
})
|
||||
|
|
@ -195,7 +196,7 @@ fn init_logger(
|
|||
};
|
||||
out.finish(format_args!(
|
||||
"{} [{}] - {}",
|
||||
now.format("%Y-%m-%d %H:%M:%S%.3f"),
|
||||
now.format(time_format_string),
|
||||
level,
|
||||
if record.target() == "stats10min" {
|
||||
Stats10Min::nice_log_format(&message)
|
||||
|
|
@ -334,8 +335,12 @@ fn main() {
|
|||
cur_stats.hail_since_startup > prev_stats.hail_since_startup,
|
||||
cur_stats.noise_since_startup > prev_stats.noise_since_startup,
|
||||
) {
|
||||
(true, true) => info!(target: "detected", "Hail and noise detected, {cur_stats}"),
|
||||
(true, false) => info!(target: "detected", "Hail detected, {cur_stats}"),
|
||||
(true, true) => {
|
||||
info!(target: "detected", "Hail and noise detected, {cur_stats}")
|
||||
}
|
||||
(true, false) => {
|
||||
info!(target: "detected", "Hail detected, {cur_stats}")
|
||||
}
|
||||
(false, true) => {
|
||||
if args.noise_logging {
|
||||
info!(target: "detected", "Noise detected, {cur_stats}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue