mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
logger: use write
with \r\n
instead of writeln
The device manager will set tty or pty to raw mode, all the `\n` will be LF without CR, which makes the output difficult to read. This commit solves it by using `write` with `\r\n` instead of `writeln`, which can print CR and LF explicitly. Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
This commit is contained in:
parent
ce0f30bb54
commit
499989fb17
@ -100,9 +100,9 @@ impl log::Log for Logger {
|
|||||||
let duration = now.duration_since(self.start);
|
let duration = now.duration_since(self.start);
|
||||||
|
|
||||||
if record.file().is_some() && record.line().is_some() {
|
if record.file().is_some() && record.line().is_some() {
|
||||||
writeln!(
|
write!(
|
||||||
*(*(self.output.lock().unwrap())),
|
*(*(self.output.lock().unwrap())),
|
||||||
"cloud-hypervisor: {:.6?}: <{}> {}:{}:{} -- {}",
|
"cloud-hypervisor: {:.6?}: <{}> {}:{}:{} -- {}\r\n",
|
||||||
duration,
|
duration,
|
||||||
std::thread::current().name().unwrap_or("anonymous"),
|
std::thread::current().name().unwrap_or("anonymous"),
|
||||||
record.level(),
|
record.level(),
|
||||||
@ -111,9 +111,9 @@ impl log::Log for Logger {
|
|||||||
record.args()
|
record.args()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
writeln!(
|
write!(
|
||||||
*(*(self.output.lock().unwrap())),
|
*(*(self.output.lock().unwrap())),
|
||||||
"cloud-hypervisor: {:.6?}: <{}> {}:{} -- {}",
|
"cloud-hypervisor: {:.6?}: <{}> {}:{} -- {}\r\n",
|
||||||
duration,
|
duration,
|
||||||
std::thread::current().name().unwrap_or("anonymous"),
|
std::thread::current().name().unwrap_or("anonymous"),
|
||||||
record.level(),
|
record.level(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user