diff --git a/CHANGELOG.md b/CHANGELOG.md index 7060f8d..323122d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ In Development - Disable log coloration when stderr is not a terminal - Suppress noisy & irrelevant log messages from various dependencies - Log errors that cause 404 and 500 responses + - Use local timezone offset for log timestamps - Added breadcrumbs to HTML views of collections - `FAST_NOT_EXIST` components are now checked for case-insensitively - Add links to version & asset metadata to the web view diff --git a/Cargo.lock b/Cargo.lock index e4e3a0f..dfb8e60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1597,6 +1597,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.32.2" @@ -2479,7 +2488,9 @@ checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "libc", "num-conv", + "num_threads", "powerfmt", "serde", "time-core", @@ -2669,6 +2680,7 @@ dependencies = [ "sharded-slab", "smallvec", "thread_local", + "time", "tracing-core", "tracing-log", ] diff --git a/Cargo.toml b/Cargo.toml index 1a95f35..7966879 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ tokio = { version = "1.36.0", features = ["macros", "net", "rt-multi-thread"] } tower = "0.4.13" tower-http = { version = "0.5.2", features = ["set-header", "trace"] } tracing = "0.1.40" -tracing-subscriber = "0.3.18" +tracing-subscriber = { version = "0.3.18", features = ["local-time", "time"] } url = { version = "2.5.0", features = ["serde"] } xml-rs = "0.8.19" diff --git a/src/main.rs b/src/main.rs index 5e2e762..0885ce4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ use std::sync::Arc; use tower::service_fn; use tower_http::{set_header::response::SetResponseHeaderLayer, trace::TraceLayer}; use tracing::Level; -use tracing_subscriber::{filter::Targets, prelude::*}; +use tracing_subscriber::{filter::Targets, fmt::time::OffsetTime, prelude::*}; static STYLESHEET: &str = include_str!("dav/static/styles.css"); @@ -64,12 +64,16 @@ struct Arguments { title: String, } -#[tokio::main] -async fn main() -> anyhow::Result<()> { - let args = Arguments::parse(); +// See +// +// for an explanation of the main + #[tokio::main]run thing +fn main() -> anyhow::Result<()> { + let timer = + OffsetTime::local_rfc_3339().context("failed to determine local timezone offset")?; tracing_subscriber::registry() .with( tracing_subscriber::fmt::layer() + .with_timer(timer) .with_ansi(stderr().is_terminal()) .with_writer(stderr), ) @@ -82,6 +86,12 @@ async fn main() -> anyhow::Result<()> { .with_default(Level::INFO), ) .init(); + run() +} + +#[tokio::main] +async fn run() -> anyhow::Result<()> { + let args = Arguments::parse(); let dandi = DandiClient::new(args.api_url)?; let zarrman = ZarrManClient::new()?; let templater = Templater::load()?;