mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
implement custom debug time formatter
This commit is contained in:
parent
18db12dad3
commit
5025e178a4
1 changed files with 10 additions and 3 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -18,10 +18,17 @@ async fn main() -> Result<()> {
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use tokio::time;
|
use tokio::time;
|
||||||
// init debug
|
// debug
|
||||||
if std::env::var("RUST_LOG").is_ok() {
|
if std::env::var("RUST_LOG").is_ok() {
|
||||||
tracing_subscriber::fmt::init()
|
use tracing_subscriber::fmt::{time::FormatTime, *};
|
||||||
} // librqbit
|
struct T;
|
||||||
|
impl FormatTime for T {
|
||||||
|
fn format_time(&self, w: &mut format::Writer<'_>) -> std::fmt::Result {
|
||||||
|
write!(w, "{}", Local::now())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt().with_timer(T).init()
|
||||||
|
}
|
||||||
// init components
|
// init components
|
||||||
let time_init = Local::now();
|
let time_init = Local::now();
|
||||||
let config = Config::parse();
|
let config = Config::parse();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue