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
Copy file name to clipboardExpand all lines: website/docs/en/contribute/development/tracing.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
-
##Tracing
1
+
# Tracing
2
2
3
3
[`tracing`](https://crates.io/crates/tracing) is used to record the internal processes of Rspack compilation, which can be used for performance analysis as well as narrow down the location of a bug.
4
4
5
-
###Enabling Tracing
5
+
## Enabling Tracing
6
6
7
7
Tracing can be enabled in two ways:
8
8
9
-
- If using `@rspack/cli`: Enable it by setting the `RSPACK_PROFILE` environment variable
9
+
- If using `@rspack/cli` or Rsbuild: Enable it by setting the `RSPACK_PROFILE` environment variable
10
10
- If directly using `@rspack/core`: Enable it through `rspack.experiments.globalTrace.register` and `rspack.experiments.globalTrace.cleanup`. You can check [how we implement `RSPACK_PROFILE` in `@rspack/cli`](https://github.com/web-infra-dev/rspack/blob/9be47217b5179186b0825ca79990ab2808aa1a0f/packages/rspack-cli/src/utils/profile.ts#L219-L224) for more information.
11
11
12
12
The generated `trace.json` file can be viewed and analyzed in [ui.perfetto.dev](https://ui.perfetto.dev/).
13
13
14
-
###Tracing Layer
14
+
## Tracing Layer
15
15
16
16
Rspack supports two types of layers: `chrome` and `logger`:
17
17
@@ -26,7 +26,7 @@ RSPACK_TRACE_LAYER=logger
26
26
RSPACK_TRACE_LAYER=chrome
27
27
```
28
28
29
-
###Tracing Output
29
+
## Tracing Output
30
30
31
31
You can specify the output location for traces:
32
32
@@ -40,7 +40,7 @@ RSPACK_TRACE_LAYER=logger RSPACK_TRACE_OUTPUT=./log.txt rspack dev
40
40
RSPACK_TRACE_LAYER=chrome RSPACK_TRACE_OUTPUT=./perfetto.json rspack dev
41
41
```
42
42
43
-
###Tracing Filter
43
+
## Tracing Filter
44
44
45
45
You can configure the data to be filtered through `RSPACK_PROFILE`. Rspack provides two preset options:
46
46
@@ -49,7 +49,7 @@ You can configure the data to be filtered through `RSPACK_PROFILE`. Rspack provi
49
49
50
50
Apart from the presets, other strings will be passed directly to [Env Filter](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax), supporting more complex filtering strategies:
51
51
52
-
####Tracing Level Filter
52
+
### Tracing Level Filter
53
53
54
54
The supported tracing levels are: `TRACE`, `DEBUG`, `INFO`, `WARN`, and `ERROR`. You can filter by level:
55
55
@@ -60,14 +60,14 @@ RSPACK_PROFILE=trace
60
60
RSPACK_PROFILE=info
61
61
```
62
62
63
-
####Module Level Filtering
63
+
### Module Level Filtering
64
64
65
65
```sh
66
66
# View rspack_resolver logs and output to terminal
0 commit comments