Logging #26
@ -30,7 +30,9 @@ use LogMessageType::GenericWarn;
|
|||||||
* or if another error occurs, such as a full disk.
|
* or if another error occurs, such as a full disk.
|
||||||
*/
|
*/
|
||||||
pub fn log_message(msg: &LogMessage, conf: &Config, file: &str, line: u32, column: u32) {
|
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.
|
// May panic if file cannot be opened or written to.
|
||||||
conf.log_path().as_ref().map_or_else(
|
conf.log_path().as_ref().map_or_else(
|
||||||
|
@ -220,7 +220,8 @@ fn log_concurrently_any_order() {
|
|||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.last()
|
.last()
|
||||||
.unwrap_or_else(|| panic!("Could not get message number from line: {line}"));
|
.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}"));
|
.unwrap_or_else(|_| panic!("Could not parse number: {num_str}"));
|
||||||
assert!(num_set.remove(&num));
|
assert!(num_set.remove(&num));
|
||||||
}
|
}
|
||||||
@ -265,7 +266,8 @@ fn log_concurrently_correct_order() {
|
|||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.last()
|
.last()
|
||||||
.unwrap_or_else(|| panic!("Could not get message number from line: {line}"));
|
.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}"));
|
.unwrap_or_else(|_| panic!("Could not parse number: {num_str}"));
|
||||||
assert!(num_set.remove(&num));
|
assert!(num_set.remove(&num));
|
||||||
assert_eq!(i, num);
|
assert_eq!(i, num);
|
||||||
|
Reference in New Issue
Block a user