mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
main: Add thread name to log output
If there is no thread then the name is reported as "anonymous". Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
e8c72b1b01
commit
8a27735826
@ -73,8 +73,9 @@ impl log::Log for Logger {
|
|||||||
if record.file().is_some() && record.line().is_some() {
|
if record.file().is_some() && record.line().is_some() {
|
||||||
writeln!(
|
writeln!(
|
||||||
*(*(self.output.lock().unwrap())),
|
*(*(self.output.lock().unwrap())),
|
||||||
"cloud-hypervisor: {:?}: {}:{}:{} -- {}",
|
"cloud-hypervisor: {:?}: <{}> {}:{}:{} -- {}",
|
||||||
duration,
|
duration,
|
||||||
|
std::thread::current().name().unwrap_or("anonymous"),
|
||||||
record.level(),
|
record.level(),
|
||||||
record.file().unwrap(),
|
record.file().unwrap(),
|
||||||
record.line().unwrap(),
|
record.line().unwrap(),
|
||||||
@ -83,8 +84,9 @@ impl log::Log for Logger {
|
|||||||
} else {
|
} else {
|
||||||
writeln!(
|
writeln!(
|
||||||
*(*(self.output.lock().unwrap())),
|
*(*(self.output.lock().unwrap())),
|
||||||
"cloud-hypervisor: {:?}: {}:{} -- {}",
|
"cloud-hypervisor: {:?}: <{}> {}:{} -- {}",
|
||||||
duration,
|
duration,
|
||||||
|
std::thread::current().name().unwrap_or("anonymous"),
|
||||||
record.level(),
|
record.level(),
|
||||||
record.target(),
|
record.target(),
|
||||||
record.args()
|
record.args()
|
||||||
|
Loading…
Reference in New Issue
Block a user