Skip to content
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

Remove redundent logging code #4059

Merged
merged 7 commits into from
Apr 12, 2024

Conversation

gilescope
Copy link
Contributor

  1. The CustomFmtContext::ContextWithFormatFields enum arm isn't actually used and thus we don't need the enum anymore.

  2. We don't do anything with most of the normalized metadata that's created by calling event.normalized_metadata(); - the target we can get from event.metadata.target() and level we can get from event.metadata.level() - let's just call them direct to simplify things. (event.metadata() is just a field call under the hood)

Changelog: No functional changes, might run a tad faster with lots of logging turned on.

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 1/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5851831

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5851813

@gilescope gilescope marked this pull request as ready for review April 9, 2024 22:36
@gilescope gilescope requested a review from koute as a code owner April 9, 2024 22:36
@bkchr bkchr added the T0-node This PR/Issue is related to the topic “node”. label Apr 12, 2024
@bkchr bkchr enabled auto-merge April 12, 2024 20:55
@bkchr bkchr added this pull request to the merge queue Apr 12, 2024
Merged via the queue into paritytech:master with commit b28ba4a Apr 12, 2024
129 of 136 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Apr 15, 2024
This PR ensures the proper logging target (ie `libp2p_tcp` or `beefy`)
is displayed.

The issue has been introduced in:
#4059, which removes the
normalized metadata of logs.

From
[documentation](https://docs.rs/tracing-log/latest/tracing_log/trait.NormalizeEvent.html#tymethod.normalized_metadata):

> In tracing-log, an Event produced by a log (through
[AsTrace](https://docs.rs/tracing-log/latest/tracing_log/trait.AsTrace.html))
has an hard coded “log” target

>
[normalized_metadata](https://docs.rs/tracing-log/latest/tracing_log/trait.NormalizeEvent.html#tymethod.normalized_metadata):
If this Event comes from a log, this method provides a new normalized
Metadata which has all available attributes from the original log,
including file, line, module_path and target

This has low implications if a version was deployed containing the
mentioned pull request, as we'll lose the ability to distinguish between
log targets.

### Before this PR

```
2024-04-15 12:45:40.327  INFO main log: Parity Polkadot
2024-04-15 12:45:40.328  INFO main log: ✌️  version 1.10.0-d1b0ef76a8b
2024-04-15 12:45:40.328  INFO main log: ❤️  by Parity Technologies <admin@parity.io>, 2017-2024
2024-04-15 12:45:40.328  INFO main log: 📋 Chain specification: Development
2024-04-15 12:45:40.328  INFO main log: 🏷  Node name: yellow-eyes-2963
2024-04-15 12:45:40.328  INFO main log: 👤 Role: AUTHORITY
2024-04-15 12:45:40.328  INFO main log: 💾 Database: RocksDb at /tmp/substrated39i9J/chains/rococo_dev/db/full
2024-04-15 12:45:44.508  WARN main log: Took active validators from set with wrong size
...

2024-04-15 12:45:45.805  INFO                 main log: 👶 Starting BABE Authorship worker
2024-04-15 12:45:45.806  INFO tokio-runtime-worker log: 🥩 BEEFY gadget waiting for BEEFY pallet to become available...
2024-04-15 12:45:45.806 DEBUG tokio-runtime-worker log: New listen address: /ip6/::1/tcp/30333
2024-04-15 12:45:45.806 DEBUG tokio-runtime-worker log: New listen address: /ip4/127.0.0.1/tcp/30333
```

### After this PR

```
2024-04-15 12:59:45.623  INFO main sc_cli::runner: Parity Polkadot
2024-04-15 12:59:45.623  INFO main sc_cli::runner: ✌️  version 1.10.0-d1b0ef76a8b
2024-04-15 12:59:45.623  INFO main sc_cli::runner: ❤️  by Parity Technologies <admin@parity.io>, 2017-2024
2024-04-15 12:59:45.623  INFO main sc_cli::runner: 📋 Chain specification: Development
2024-04-15 12:59:45.623  INFO main sc_cli::runner: 🏷  Node name: helpless-lizards-0550
2024-04-15 12:59:45.623  INFO main sc_cli::runner: 👤 Role: AUTHORITY
...
2024-04-15 12:59:50.204  INFO tokio-runtime-worker beefy: 🥩 BEEFY gadget waiting for BEEFY pallet to become available...
2024-04-15 12:59:50.204 DEBUG tokio-runtime-worker libp2p_tcp: New listen address: /ip6/::1/tcp/30333
2024-04-15 12:59:50.204 DEBUG tokio-runtime-worker libp2p_tcp: New listen address: /ip4/127.0.0.1/tcp/30333
```

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T0-node This PR/Issue is related to the topic “node”.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants