mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
Small fix for log line prefix (#7373)
This commit is contained in:
@@ -423,6 +423,11 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn prefix_in_log_lines() {
|
||||
let re = regex::Regex::new(&format!(
|
||||
r"^\d{{4}}-\d{{2}}-\d{{2}} \d{{2}}:\d{{2}}:\d{{2}} \[{}\] {}$",
|
||||
EXPECTED_NODE_NAME,
|
||||
EXPECTED_LOG_MESSAGE,
|
||||
)).unwrap();
|
||||
let executable = env::current_exe().unwrap();
|
||||
let output = Command::new(executable)
|
||||
.env("ENABLE_LOGGING", "1")
|
||||
@@ -431,7 +436,10 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let output = String::from_utf8(output.stderr).unwrap();
|
||||
assert!(output.contains(&format!(" [{}] ", EXPECTED_NODE_NAME)));
|
||||
assert!(
|
||||
re.is_match(output.trim()),
|
||||
format!("Expected:\n{}\nGot:\n{}", re, output),
|
||||
);
|
||||
}
|
||||
|
||||
/// This is no actual test, it will be used by the `prefix_in_log_lines` test.
|
||||
@@ -448,6 +456,6 @@ mod tests {
|
||||
|
||||
#[crate::prefix_logs_with(EXPECTED_NODE_NAME)]
|
||||
fn prefix_in_log_lines_process() {
|
||||
log::info!("Hello World!");
|
||||
log::info!("{}", EXPECTED_LOG_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user