-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce tracing #37
base: develop
Are you sure you want to change the base?
Conversation
|
info!("Eth1 RPC URLs: [{}]", eth1_rpc_urls.iter().format(", ")); | ||
info!("Eth1 RPC URLs: {:?}", eth1_rpc_urls); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is required when switching from the log
to the tracing
crate, because otherwise a panic ensues
thread 'main' panicked at /home/zarathustra/.cargo/registry/src/index.crates.io-6f17d22bba15001f/itertools-0.13.0/src/format.rs:95:21:
Format: was already formatted once
This is important to note, because this is not a compilation but a runtime error, which entails that in case of this being an issue elsewhere - meaning where log
has been exchanged for tracing
- the invocation of any of the associated macro's may cause the program to panic.
This leads me to ponder the question how we can best ensure this doesn't occur. There are cumbersome ways of achieving this, by writing individual tests for modules, or by gathering all log messages through the execution of the test suite (i.e. file, line, level, message) and ensuring that all those present in the code are found in the logs. A better approach seems to me to assess the test coverage (as in which lines are of the code are ran during execution of the test suite) and then making sure that all lines with tracing macro's have been covered; this would mean they must have logged, and in case of a panic the test would not have passed.
pub fn setup_tracing() -> impl Drop { | ||
let log_path = "logs/testing.log"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: proper filename
I am not going to sign this. Please close my PR if this is a strict requirement and I will move on and spend my time elsewhere |
I'm very interested why signing CLA is an issue. Are you against the fact that you need to sign anything (no matter what is it)? Or you are not happy that your contribution could be published under some other license too (we need this because we already hear that people would like to get Grandine licensed under some other licenses, so we may need to relicense in the future if critical mass is reached). In any case, your contribution will be always available under the current GPL license. This CLA is generated with https://contributoragreements.org/. |
and start to replace the
log
crate.Update: so far in all but three directories of the repositories the
log
crate has been replaced with thetracing
crate. The modules that remain are:features/tests/both_syntaxes_produce_correct_output.rs
p2p/src/sync_manager.rs
validator/src/validator.rs
with the reason being that the
log::log
macro andlog::Level
enum are used, which do not have a direct equivalent ontracing
. Noteworthy there is a self-implementedlog
macro as wellThese will be addressed in a subsequent PR that will be opened on top of this base PR.