-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
event.metadata().level() == &Level::WARN || | ||
event.metadata().level() == &Level::ERROR | ||
) { | ||
let mut out = String::new(); |
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.
I think in tracing they tried to avoid re-allocation using lazy_static. Probably for performance reasons... 🤔 but I can't find the code anymore
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.
Found it, it is thread_local: https://github.com/tokio-rs/tracing/blob/master/tracing-subscriber/src/fmt/fmt_subscriber.rs#L674
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.
(Maybe it's not relevant here I don't know)
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.
The string will only be allocated in the specific use case and only for INFO|WAR|ERROR messages that are rare. So I wouldn't bother.
* master: (84 commits) Duplicate logging to stdout (#8495) Fix sync restart (#8497) client: fix justifications migration (#8489) helper macro to create storage types on the fly (#8456) Make `BlockImport` and `Verifier` async (#8472) Get rid of `test-helpers` feature in sc-consensus-babe (#8486) Enhancement on Substrate Node Template (#8473) Add Social Network (#8065) Prepare UI tests for Rust 1.51 & new CI image (#8474) Benchmarking pallet-example (#8301) Use pathbuf for remote externalities (#8480) Bring back the on_finalize weight of staking. (#8463) Implement `fungible::*` for Balances (#8454) make types within `generate_solution_type` macro explicit (#8447) [pallet-staking] Refund unused weight for `payout_stakers` (#8458) Use `async_trait` in sc-consensus-slots (#8461) Repot frame_support::traits; introduce some new currency stuff (#8435) Fix &mut self -> &self in add_known_address (#8468) Add NetworkService::add_known_address (#8467) Fix companion check (#8464) ...
* Duplicate logging to stdout * Update client/tracing/src/logging/event_format.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Duplicate logging to stdout * Update client/tracing/src/logging/event_format.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
When logging to a file with additional logging targets set, it is useful to see basic progress and errors in the console. Substrate used to have this feature, but it was lost in a recent logging system refactoring. This PR restores it.