Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue (if exists)
#2989, not sure if we could close that.
Summary
TRACE
,INFO
, etc, to enable tracing . The method we used before has a pitfall, we can't did some fine-grained event filter, for example, only emit the event in functionrspack_core::compiler::compilation:xxxx
. This might be a problem when you are trying to debug a big project which might have thousands of modules, the tracing file would be too long to read.rspack*
crate, you could useor for javascript
If you only care about event in mod
rspack_core::compiler::compilation
you could use🤖 Generated by Copilot at 50acdb1
This pull request improves the tracing functionality for the
bench
andrspack_tracing
crates. It allows thebench
crate to select different tracing output formats by setting an environment variable. It also simplifies the tracing configuration and output in therspack_tracing
crate by using theEnvFilter
layer.Walkthrough
🤖 Generated by Copilot at 50acdb1
Layer
enum to control tracing output format (link)FromStr
trait to implementLayer
enum (link)run
function to takelayer
parameter and pass it to tracing initialization functions (link)Option<FlushGuard>
from tracing initialization functions to flush output when out of scope (link, link)TRACE
environment variable (link)EnvFilter
layer to allow user to specify target and level filters by environment variable (link)#[cfg(feature = "tracing")]
attribute and always enable tracing feature (link)smoke-example/basic
path (link)