-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature named enable-console-log.
This feature can be enable to print log messages to console in addition to storing them in the log buffer. Enable this feature by default for debug builds. Signed-off-by: Vasant Karasulli <[email protected]>
- Loading branch information
Showing
6 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
// Copyright (c) 2022-2023 SUSE LLC | ||
// | ||
// Author: Vasant Karasulli <[email protected]> | ||
#[cfg(feature = "enable-console-log")] | ||
use crate::console::_print; | ||
|
||
use crate::cpu::percpu::this_cpu_mut; | ||
use crate::log_buffer::LB; | ||
|
@@ -87,18 +89,30 @@ impl log::Log for BufferLogger { | |
line_buf | ||
.write_fmt(format_args!("[{}] {}: {}\n", comp, lvl, rec_args)) | ||
.unwrap(); | ||
#[cfg(feature = "enable-console-log")] | ||
{ | ||
_print(format_args!("[{}] {}: {}\n", comp, lvl, rec_args)); | ||
} | ||
} | ||
|
||
log::Level::Info => { | ||
line_buf | ||
.write_fmt(format_args!("[{}] {}\n", comp, rec_args)) | ||
.unwrap(); | ||
#[cfg(feature = "enable-console-log")] | ||
{ | ||
_print(format_args!("[{}] {}\n", comp, rec_args)); | ||
} | ||
} | ||
|
||
log::Level::Debug | log::Level::Trace => { | ||
line_buf | ||
.write_fmt(format_args!("[{}/{}] {} {}\n", comp, target, lvl, rec_args)) | ||
.unwrap(); | ||
#[cfg(feature = "enable-console-log")] | ||
{ | ||
_print(format_args!("[{}/{}] {} {}\n", comp, target, lvl, rec_args)); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters