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) {
|
||||
eprintln!(
|
||||
"[{}] [error] {e}",
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_millis()
|
||||
)
|
||||
eprintln!("[{}] [error] {e}", now())
|
||||
}
|
||||
|
||||
pub fn info(message: String) {
|
||||
eprintln!(
|
||||
"[{}] [info] {message}",
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_millis()
|
||||
)
|
||||
eprintln!("[{}] [info] {message}", now())
|
||||
}
|
||||
|
||||
fn now() -> u128 {
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_millis()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue