You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
tracing (https://docs.rs/tracing/0.1.18/tracing/) is a logging framework that can act as an alternative to log. By using tracing it becomes possible to get structured logs and output in different formats. It also supports scoping and dynamic log filtering. Rust compiler also recently moved from log to tracing. rust-lang/rust#74726
The goal of this issue would be to convert the code base from majority log-based, to majority tracing-based. The interface is compatible, so once the conversion is done, we can then gradually add additional structural data into the logging.
From my look we can convert all use cases of log to tracing drop-in, with only one exception:
frame_support::debug. The issue with this is that it crosses the wasm boundary and it already exports a wasm API that is slightly log-specific. So I think we keep it as log for now.
There will also be dependency crates using log. As a result we need the log compatibility layer for tracing.
The current default logger of log is changed to be tracing_log::LogTracer. This converts all log records to tracing events, and make it available to tracing subscribers.
Then, we collect all logs in tracing subscribers and handle the output with combination of sp_tracing::ProfilingSubscriber and tracing_subscriber::FmtSubscriber.
I'm wondering if it's possible to use a single subscriber, possibly the FmtSubscriber, with an extra Layer (https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/layer/trait.Layer.html) to do the time profiling and other things we need. I think it should also be feasible to dynamically filter which Spans we wish to profile and which we do not, so we don't incur the extra cost of that where not required.
tracing
(https://docs.rs/tracing/0.1.18/tracing/) is a logging framework that can act as an alternative tolog
. By usingtracing
it becomes possible to get structured logs and output in different formats. It also supports scoping and dynamic log filtering. Rust compiler also recently moved fromlog
totracing
. rust-lang/rust#74726The goal of this issue would be to convert the code base from majority
log
-based, to majoritytracing
-based. The interface is compatible, so once the conversion is done, we can then gradually add additional structural data into the logging.From my look we can convert all use cases of
log
totracing
drop-in, with only one exception:frame_support::debug
. The issue with this is that it crosses the wasm boundary and it already exports a wasm API that is slightlylog
-specific. So I think we keep it aslog
for now.There will also be dependency crates using
log
. As a result we need thelog
compatibility layer fortracing
.log
is changed to betracing_log::LogTracer
. This converts all log records to tracing events, and make it available to tracing subscribers.sp_tracing::ProfilingSubscriber
andtracing_subscriber::FmtSubscriber
.cc @mattrutherford
The text was updated successfully, but these errors were encountered: