Add location to log function
This commit is contained in:
parent
eac1ffbda6
commit
0fbc65e24b
1 changed files with 3 additions and 1 deletions
|
|
@ -1,7 +1,9 @@
|
|||
#[track_caller]
|
||||
pub fn elog(message: &str) {
|
||||
if let Ok(debug) = std::env::var("DEBUG")
|
||||
&& !debug.is_empty()
|
||||
{
|
||||
eprintln!(" [log] {message}");
|
||||
let location = std::panic::Location::caller();
|
||||
eprintln!(" !debug [{location}] {message}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue