use shared function

This commit is contained in:
yggverse 2025-06-07 17:46:58 +03:00
parent 58c2e6e108
commit eac6d0dc07

View file

@ -1,21 +1,14 @@
use std::time::{SystemTime, UNIX_EPOCH};
pub fn error(e: &anyhow::Error) { pub fn error(e: &anyhow::Error) {
eprintln!( eprintln!("[{}] [error] {e}", now())
"[{}] [error] {e}",
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis()
)
} }
pub fn info(message: String) { pub fn info(message: String) {
eprintln!( eprintln!("[{}] [info] {message}", now())
"[{}] [info] {message}", }
SystemTime::now()
.duration_since(UNIX_EPOCH) fn now() -> u128 {
.unwrap() std::time::SystemTime::now()
.as_millis() .duration_since(std::time::UNIX_EPOCH)
) .unwrap()
.as_millis()
} }