Logging #26

Open
leon wants to merge 33 commits from Logging into main
2 changed files with 7 additions and 3 deletions
Showing only changes of commit eed7053b6d - Show all commits

View File

@ -30,7 +30,9 @@ use LogMessageType::GenericWarn;
* or if another error occurs, such as a full disk.
*/
pub fn log_message(msg: &LogMessage, conf: &Config, file: &str, line: u32, column: u32) {
let Some(log_line) = log_to_str(msg, conf, file, line, column) else { return };
let Some(log_line) = log_to_str(msg, conf, file, line, column) else {
return;
};
// May panic if file cannot be opened or written to.
conf.log_path().as_ref().map_or_else(

View File

@ -220,7 +220,8 @@ fn log_concurrently_any_order() {
.split_whitespace()
.last()
.unwrap_or_else(|| panic!("Could not get message number from line: {line}"));
let num = usize::from_str_radix(num_str, 10)
let num = num_str
.parse()
.unwrap_or_else(|_| panic!("Could not parse number: {num_str}"));
assert!(num_set.remove(&num));
}
@ -265,7 +266,8 @@ fn log_concurrently_correct_order() {
.split_whitespace()
.last()
.unwrap_or_else(|| panic!("Could not get message number from line: {line}"));
let num = usize::from_str_radix(num_str, 10)
let num = num_str
.parse()
.unwrap_or_else(|_| panic!("Could not parse number: {num_str}"));
assert!(num_set.remove(&num));
assert_eq!(i, num);