Skip to content

Commit

Permalink
ログの時刻をマイクロ秒単位に揃える (VOICEVOX#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip authored Mar 8, 2023
1 parent dcd5653 commit 553ce97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/voicevox_core_c_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mod compatible_engine;
mod helpers;
use self::helpers::*;
use chrono::SecondsFormat;
use is_terminal::IsTerminal;
use libc::c_void;
use once_cell::sync::Lazy;
Expand Down Expand Up @@ -41,7 +42,9 @@ static INTERNAL: Lazy<Mutex<Internal>> = Lazy::new(|| {
}

fn local_time(wtr: &mut Writer<'_>) -> fmt::Result {
wtr.write_str(&chrono::Local::now().to_rfc3339())
// ローカル時刻で表示はするが、そのフォーマットはtracing-subscriber本来のものに近いようにする。
// https://github.com/tokio-rs/tracing/blob/tracing-subscriber-0.3.16/tracing-subscriber/src/fmt/time/datetime.rs#L235-L241
wtr.write_str(&chrono::Local::now().to_rfc3339_opts(SecondsFormat::Micros, false))
}

fn out() -> impl IsTerminal + Write {
Expand Down

0 comments on commit 553ce97

Please sign in to comment.