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
1 changed files with 4 additions and 2 deletions
|
|
@ -73,8 +73,9 @@ impl log::Log for Logger {
|
|||
if record.file().is_some() && record.line().is_some() {
|
||||
writeln!(
|
||||
*(*(self.output.lock().unwrap())),
|
||||
"cloud-hypervisor: {:?}: {}:{}:{} -- {}",
|
||||
"cloud-hypervisor: {:?}: <{}> {}:{}:{} -- {}",
|
||||
duration,
|
||||
std::thread::current().name().unwrap_or("anonymous"),
|
||||
record.level(),
|
||||
record.file().unwrap(),
|
||||
record.line().unwrap(),
|
||||
|
|
@ -83,8 +84,9 @@ impl log::Log for Logger {
|
|||
} else {
|
||||
writeln!(
|
||||
*(*(self.output.lock().unwrap())),
|
||||
"cloud-hypervisor: {:?}: {}:{} -- {}",
|
||||
"cloud-hypervisor: {:?}: <{}> {}:{} -- {}",
|
||||
duration,
|
||||
std::thread::current().name().unwrap_or("anonymous"),
|
||||
record.level(),
|
||||
record.target(),
|
||||
record.args()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue