-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace log with tracing on pallet-bridge-grandpa
#9294
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
Changes from 4 commits
79967fe
8582358
016fc26
45632ae
1be97ce
7da8b77
746c791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,10 +219,10 @@ pub mod pallet { | |
| ensure!(init_allowed, <Error<T, I>>::AlreadyInitialized); | ||
| initialize_bridge::<T, I>(init_data.clone())?; | ||
|
|
||
| log::info!( | ||
| tracing::info!( | ||
| target: LOG_TARGET, | ||
| "Pallet has been initialized with the following parameters: {:?}", | ||
| init_data | ||
| parameters=?init_data, | ||
| "Pallet has been initialized" | ||
| ); | ||
|
|
||
| Ok(().into()) | ||
|
|
@@ -292,10 +292,10 @@ pub mod pallet { | |
| ensure_signed(origin)?; | ||
|
|
||
| let (hash, number) = (finality_target.hash(), *finality_target.number()); | ||
| log::trace!( | ||
| tracing::trace!( | ||
| target: LOG_TARGET, | ||
| "Going to try and finalize header {:?}", | ||
| finality_target | ||
| header=?finality_target, | ||
| "Going to try and finalize header" | ||
| ); | ||
|
|
||
| // it checks whether the `number` is better than the current best block number | ||
|
|
@@ -332,10 +332,10 @@ pub mod pallet { | |
| // to pay for the transaction. | ||
| let pays_fee = if may_refund_call_fee { Pays::No } else { Pays::Yes }; | ||
|
|
||
| log::info!( | ||
| tracing::info!( | ||
| target: LOG_TARGET, | ||
| "Successfully imported finalized header with hash {:?}! Free: {}", | ||
| hash, | ||
| ?hash, | ||
| "Successfully imported finalized header! Free: {}", | ||
| if may_refund_call_fee { "Yes" } else { "No" }, | ||
|
||
| ); | ||
|
|
||
|
|
@@ -656,12 +656,12 @@ pub mod pallet { | |
|
|
||
| <CurrentAuthoritySet<T, I>>::put(&next_authorities); | ||
|
|
||
| log::info!( | ||
| tracing::info!( | ||
| target: LOG_TARGET, | ||
| "Transitioned from authority set {} to {}! New authorities are: {:?}", | ||
| old_current_set_id, | ||
| new_current_set_id, | ||
| next_authorities, | ||
| %old_current_set_id, | ||
| %new_current_set_id, | ||
| ?next_authorities, | ||
| "Transitioned from authority set!" | ||
| ); | ||
|
|
||
| Ok(Some(next_authorities.into())) | ||
|
|
@@ -687,11 +687,11 @@ pub mod pallet { | |
| justification, | ||
| ) | ||
| .map_err(|e| { | ||
| log::error!( | ||
| tracing::error!( | ||
| target: LOG_TARGET, | ||
| "Received invalid justification for {:?}: {:?}", | ||
| hash, | ||
| e, | ||
| error=?e, | ||
| ?hash, | ||
| "Received invalid justification" | ||
| ); | ||
| <Error<T, I>>::InvalidJustification | ||
| })?) | ||
|
|
@@ -714,7 +714,7 @@ pub mod pallet { | |
| // Update ring buffer pointer and remove old header. | ||
| <ImportedHashesPointer<T, I>>::put((index + 1) % T::HeadersToKeep::get()); | ||
| if let Ok(hash) = pruning { | ||
| log::debug!(target: LOG_TARGET, "Pruning old header: {:?}.", hash); | ||
| tracing::debug!(target: LOG_TARGET, ?hash, "Pruning old header."); | ||
| <ImportedHeaders<T, I>>::remove(hash); | ||
| } | ||
| } | ||
|
|
@@ -729,10 +729,9 @@ pub mod pallet { | |
| let authority_set_length = authority_list.len(); | ||
| let authority_set = StoredAuthoritySet::<T, I>::try_new(authority_list, set_id) | ||
| .inspect_err(|_| { | ||
| log::error!( | ||
| tracing::error!( | ||
| target: LOG_TARGET, | ||
| "Failed to initialize bridge. Number of authorities in the set {} is larger than the configured value {}", | ||
| authority_set_length, | ||
| "Failed to initialize bridge. Number of authorities in the set {authority_set_length} is larger than the configured value {}", | ||
|
||
| T::BridgedChain::MAX_AUTHORITIES_COUNT, | ||
| ); | ||
| })?; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| title: Replace `log` with `tracing` on `pallet-bridge-grandpa` | ||
| doc: | ||
| - audience: Runtime Dev | ||
| description: This PR replaces `log` with `tracing` instrumentation on `pallet-bridge-grandpa` | ||
| by providing structured logging. | ||
| crates: | ||
| - name: pallet-bridge-grandpa | ||
| bump: minor |
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.
do you leave these
{:?} header {:?}on purpose here ?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.
Changed