Skip to content

Commit

Permalink
Reverted chrono back to time thanks to new bp3d-os time feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri6037 committed Aug 9, 2023
1 parent 15b098f commit 2dadee9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ categories = []

[dependencies]
log = "0.4.14"
bp3d-os = { version = "1.0.0-rc.1.1.0", features=["dirs"] }
bp3d-os = { version = "1.0.0-rc.1.2.0", features=["dirs", "time"] }
crossbeam-channel = "0.5.2"
crossbeam-queue = "0.3.8"
once_cell = "1.10.0"
chrono = "0.4.23"
time = { version = "0.3.0", features = ["formatting", "macros"] }
termcolor = "1.1.3"
atty = "0.2.14"

Expand Down
9 changes: 6 additions & 3 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@

use crate::backend::Backend;
use crate::{LogMsg, Logger};
use chrono::Local;
use bp3d_os::time::LocalOffsetDateTime;
use crossbeam_channel::{bounded, Receiver, Sender};
use crossbeam_queue::ArrayQueue;
use log::{Level, Log, Metadata, Record};
use time::OffsetDateTime;
use time::macros::format_description;
use std::fmt::Write;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -274,8 +276,9 @@ impl Log for LoggerImpl {
return;
}
let (target, module) = extract_target_module(record);
let time = Local::now();
let formatted = time.format("%a %b %d %Y %I:%M:%S %P");
let time = OffsetDateTime::now_local();
let format = format_description!("[weekday repr:short] [month repr:short] [day] [hour repr:12]:[minute]:[second] [period case:upper]");
let formatted = time.unwrap_or_else(OffsetDateTime::now_utc).format(format).unwrap_or_default();
let mut msg = LogMsg::new(target, record.level());
let _ = write!(
msg,
Expand Down

0 comments on commit 2dadee9

Please sign in to comment.