Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions lore-base/src/log/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,12 @@ pub fn dispatch_log(level: LoreLogLevel, location: &str, message: &str) {

#[macro_export]
macro_rules! lore_trace {
($fmt:expr $(, $arg:expr)* $(,)?) => {{
#[cfg(not(feature = "trace_log"))]
if false {
let _ = core::format_args!($fmt $(, $arg)*);
}
#[cfg(feature = "trace_log")]
if true {
$crate::lore_log_event!(
$crate::log::LoreLogLevel::Trace,
$fmt $(, $arg)*
)
}
}};
($fmt:expr $(, $arg:expr)* $(,)?) => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trace feature is intentional as it reduces the amount of formatting done prior to log level filtering. Revert this change and update your PR description - this change would severly impact performance.

$crate::lore_log_event!(
$crate::log::LoreLogLevel::Trace,
$fmt $(, $arg)*
)
};
}

#[macro_export]
Expand Down
1 change: 0 additions & 1 deletion lore-client/src/cli/client_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn client_main() -> ExitCode {
cli.non_interactive,
);

lore::log::initialize();
lore::log::configure(&log_config);

if let Some(max_threads) = cli.max_threads {
Expand Down
10 changes: 6 additions & 4 deletions lore/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,18 @@ pub fn log_level() -> LoreLogLevel {
pub fn configure(config: &LoreLogConfig) {
initialize();

if config.file == 0 {
return;
}

let mut config = config.clone();

if config.level == LoreLogLevel::None {
config.level = LoreLogLevel::Info;
}

lore_base::log::set_log_level(config.level);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will effectively remove all debug log messages from the log file by default - the config level is for the log event filtering, while the lore base log level is kept at default to get all debug messages written to the log file.


if config.file == 0 {
return;
}

let prefix = if !config.file_prefix.is_empty() {
config.file_prefix.to_string()
} else {
Expand Down