mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
Add the thread id and name to info and warn log output
This commit is contained in:
committed by
holger krekel
parent
e3031462c1
commit
d7f345eef8
16
src/log.rs
16
src/log.rs
@@ -7,7 +7,13 @@ macro_rules! info {
|
||||
};
|
||||
($ctx:expr, $msg:expr, $($args:expr),* $(,)?) => {{
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let full = format!("{}:{}: {}", file!(), line!(), &formatted);
|
||||
let thread = ::std::thread::current();
|
||||
let full = format!("{thid:?}/{thname} {file}:{line}: {msg}",
|
||||
thid = thread.id(),
|
||||
thname = thread.name().unwrap_or("unnamed"),
|
||||
file = file!(),
|
||||
line = line!(),
|
||||
msg = &formatted);
|
||||
emit_event!($ctx, $crate::Event::Info(full));
|
||||
}};
|
||||
}
|
||||
@@ -19,7 +25,13 @@ macro_rules! warn {
|
||||
};
|
||||
($ctx:expr, $msg:expr, $($args:expr),* $(,)?) => {{
|
||||
let formatted = format!($msg, $($args),*);
|
||||
let full = format!("{}:{}: {}", file!(), line!(), &formatted);
|
||||
let thread = ::std::thread::current();
|
||||
let full = format!("{thid:?}/{thname} {file}:{line}: {msg}",
|
||||
thid = thread.id(),
|
||||
thname = thread.name().unwrap_or("unnamed"),
|
||||
file = file!(),
|
||||
line = line!(),
|
||||
msg = &formatted);
|
||||
emit_event!($ctx, $crate::Event::Warning(full));
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user