mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
use shared function
This commit is contained in:
parent
58c2e6e108
commit
eac6d0dc07
1 changed files with 9 additions and 16 deletions
25
src/debug.rs
25
src/debug.rs
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue