Skip to content

Commit

Permalink
[rust] Include field for error message in the minimal JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Jan 19, 2024
1 parent 40ab340 commit 86b1f4f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rust/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct JsonOutput {
pub struct MinimalJson {
pub driver_path: String,
pub browser_path: String,
pub message: String,
}

impl Logger {
Expand Down Expand Up @@ -211,13 +212,15 @@ impl Logger {
}
}
_ => {
if self.output == OutputType::Mixed && level == Level::Info {
if self.output == OutputType::Mixed && level == Level::Info || level <= Level::Error {
if message.starts_with(DRIVER_PATH) {
self.minimal_json.borrow_mut().driver_path =
self.clean_driver_path(&message);
} else if message.starts_with(BROWSER_PATH) {
self.minimal_json.borrow_mut().browser_path =
self.clean_browser_path(&message);
} else {
self.minimal_json.borrow_mut().message = message.clone();
}
}
log::log!(level, "{}", message);
Expand Down

0 comments on commit 86b1f4f

Please sign in to comment.