test-log
test-log copied to clipboard
custom log format with date and line of code
This crate is a good idea. We have in our current tests a custom log format to log e.g. the line of code and the time. We do this to easier debug and understand quicker, where tests fail.
2023-12-11T09:51:28.903Z INFO module::api_tests 277: api_tests_007_authenticate_user start ...
init_logger() ...
tracing_subscriber::fmt()
.with_timer(timer)
.with_line_number(true)
.with_writer(std::io::stdout)
.with_env_filter(EnvFilter::from_default_env())
.try_init();
Today we call in each test our own init_logger().
No idea, how to achieve the same log format with the test_log macro. Is it possible to enhance the macro to support a custom log format?