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
chore!: Remove debug and winston in favor of pino (#10355)
First steps for logging cleanup. Removes all traces of `debug` and
`winston` in favor of `pino`.
Fixes#10118
## Breaking changes
- `DEBUG` variable is no longer used. Instead, overloads `LOG_LEVEL` by
allowing a list of modules to have non-default log levels. For example,
`LOG_LEVEL="info; verbose: aztec:sequencer, aztec:archiver; debug:
aztec:kv-store"` sets `info` as the default log level, `verbose` for the
sequencer and archiver, and `debug` for the kv-store. Match is by
prefix.
## Levels
Defines the following logging levels, all of them standard in pino,
except for `verbose` which we already used extensively before:
- fatal: Use when an error has brought down the system.
- error: Use for errors in general.
- warn: Use for when we stray from the happy path.
- info: Use for providing an operator with info on what the system is
doing.
- verbose: Use for when we need additional insight on what a subsystem
is doing.
- debug: Use for when we need debugging info to troubleshoot an issue on
a specific component.
- trace: Use for when we want to denial-of-service any recipient of the
logs.
Fixes#10116
## Filtering
Removes usage of the `DEBUG` env var for log filtering. Instead,
overloads `LOG_LEVEL` by allowing a list of modules to have non-default
log levels. For example, `LOG_LEVEL="info; verbose: aztec:sequencer,
aztec:archiver; debug: aztec:kv-store"` sets `info` as the default log
level, `verbose` for the sequencer and archiver, and `debug` for the
kv-store. Match is by prefix.
Fixes#10119
## OTEL integration
Vendors the OTEL pino stream from `openetelemetry/instrumentation-pino`
and configures it as an additional transport if the
`OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` env var is set. Using the
instrumentation-pino directly would have required buying in fully into
the opentelemetry node sdk, which we preferred to avoid so we have more
fine-grained control, and it also pollutes the main worker thread.
Instead, we vendor the stream code and initialize it within a transport,
which runs it on a worker thread.
As for log correlation, instead of having `instrumentation-pino`
monkey-patch pino, we wrap the call to the logger to manually inject the
trace and span id, which ensures that tempo can load the relevant logs
for a trace in loki.
https://github.com/user-attachments/assets/9421a22f-4c5a-49f7-80da-ab3e14d323baFixes#10121Fixes#10123
## Pretty logs
Pino logs to json by default, but if `LOG_JSON` is not set, we
programmatically set up `pino-pretty` for console logging. Looks like
this:

Fixes#10126
## DEBUG settings
Given we no longer use `DEBUG`, we remove this variable from most
scripts. Since we were using modules to silence some noisy namespaces,
we tweak those calls to be passed as `trace` instead, so we can enable
debug without fear of being bombarded.
For reference, the default `DEBUG` string used in scripts was:
```
aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*
```
---------
Co-authored-by: Mitch <mitchell@aztecprotocol.com>
Copy file name to clipboardexpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ This provide an interactive environment for debugging the CI test.
47
47
48
48
## Debugging
49
49
50
-
Logging goes through the [DebugLogger](yarn-project/foundation/src/log/debug.ts) module in Typescript. To see the log output, set a `DEBUG` environment variable to the name of the module you want to debug, to `aztec:*`, or to `*` to see all logs.
50
+
Logging goes through the [DebugLogger](yarn-project/foundation/src/log/debug.ts) module in Typescript. `LOG_LEVEL` controls the default log level, and one can set alternate levels for specific modules, such as `debug; warn: module1, module2; error: module3`.
Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.
8
8
9
+
## 0.66
10
+
11
+
### DEBUG env var is removed
12
+
13
+
The `DEBUG` variable is no longer used. Use `LOG_LEVEL` with one of `silent`, `fatal`, `error`, `warn`, `info`, `verbose`, `debug`, or `trace`. To tweak log levels per module, add a list of module prefixes with their overridden level. For example, LOG_LEVEL="info; verbose: aztec:sequencer, aztec:archiver; debug: aztec:kv-store" sets `info` as the default log level, `verbose` for the sequencer and archiver, and `debug` for the kv-store. Module name match is done by prefix.
14
+
15
+
### `tty` resolve fallback required for browser bundling
16
+
17
+
When bundling `aztec.js` for web, the `tty` package now needs to be specified as an empty fallback:
0 commit comments