Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Remove debug and winston in favor of pino #10355

Merged
merged 13 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This provide an interactive environment for debugging the CI test.

## Debugging

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.
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`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason this isn't simply JSON?
[["debug"], ["warn", "module1", "module2"], ["error", "module3"]]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that LOG_LEVEL will often be set manually, and JSON is annoying to type. But I'm happy to go with any other DSL.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, all good with me


## Releases

Expand Down
4 changes: 2 additions & 2 deletions aztec-up/bin/.aztec-run
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ while [[ "$#" -gt 0 ]]; do
done

DOCKER_ENV="-e HOME=$HOME"
if ! [ -z "${DEBUG:-}" ] ; then
DOCKER_ENV="-e DEBUG=$DEBUG"
if ! [ -z "${LOG_LEVEL:-}" ] ; then
DOCKER_ENV="-e LOG_LEVEL=$LOG_LEVEL"
fi
for env in ${ENV_VARS_TO_INJECT:-}; do
# SSH_AUTH_SOCK must be handled separately
Expand Down
2 changes: 1 addition & 1 deletion aztec-up/bin/docker-compose.sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
ports:
- "${PXE_PORT:-8080}:${PXE_PORT:-8080}"
environment:
DEBUG: # Loaded from the user shell if explicitly set
LOG_LEVEL: # Loaded from the user shell if explicitly set
HOST_WORKDIR: "${PWD}" # Loaded from the user shell to show log files absolute path in host
ETHEREUM_HOST: ${ETHEREUM_HOST:-http://ethereum}:${ANVIL_PORT:-8545}
L1_CHAIN_ID: 31337
Expand Down
1 change: 0 additions & 1 deletion aztec-up/bin/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ services:
txe:
image: "aztecprotocol/aztec"
environment:
DEBUG: # Loaded from the user shell if explicitly set
LOG_LEVEL: # Loaded from the user shell if explicitly set
HOST_WORKDIR: "${PWD}" # Loaded from the user shell to show log files absolute path in host
volumes:
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
platform: linux/amd64
environment:
LOG_LEVEL: ${LOG_LEVEL:-info}
DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton}
DEBUG_COLORS: 1
L1_CHAIN_ID: 31337
VERSION: 1
PXE_PROVER_ENABLED: ${PXE_PROVER_ENABLED:-1}
Expand Down Expand Up @@ -38,8 +36,6 @@ services:
platform: linux/amd64
environment:
LOG_LEVEL: ${LOG_LEVEL:-info}
DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton,-aztec:avm_simulator:*}
DEBUG_COLORS: 1
L1_CHAIN_ID: 31337
VERSION: 1
NODE_NO_WARNINGS: 1
Expand Down
29 changes: 29 additions & 0 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,35 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading]

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.

## 0.66

### DEBUG env var is removed

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.

### `tty` resolve fallback required for browser bundling

When bundling `aztec.js` for web, the `tty` package now needs to be specified as an empty fallback:

```diff
resolve: {
plugins: [new ResolveTypeScriptPlugin()],
alias: { './node/index.js': false },
fallback: {
crypto: false,
os: false,
fs: false,
path: false,
url: false,
+ tty: false,
worker_threads: false,
buffer: require.resolve('buffer/'),
util: require.resolve('util/'),
stream: require.resolve('stream-browserify'),
},
},
```

## 0.65

### [aztec.nr] Removed SharedImmutable
Expand Down
5 changes: 2 additions & 3 deletions docs/docs/reference/developer_references/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ debug_log_array(my_array);

### Start Sandbox in debug mode

Update the `DEBUG` environment variable in docker-compose.sandbox.yml to the following:
Set `LOG_LEVEL` to `verbose` or `debug`:

```yml
# ~/.aztec/docker-compose.sandbox.yml
Expand All @@ -65,8 +65,7 @@ aztec:
ports:
- "${PXE_PORT:-8080}:${PXE_PORT:-8080}"
environment:
DEBUG: aztec:simulator:client_execution_context, aztec:sandbox, aztec:avm_simulator:debug_log
LOG_LEVEL: verbose # optionally add this for more logs
LOG_LEVEL: verbose
# ...
```

Expand Down
6 changes: 3 additions & 3 deletions spartan/aztec-network/files/config/config-validator-env.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
set -eu

# Pass the bootnode url as an argument
# Ask the bootnode for l1 contract addresses
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-node-info --node-url $1)
# Pass a PXE url as an argument
# Ask the PXE's node for l1 contract addresses
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-node-info -u $1 --node-url '')

echo "$output"

Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/deploy-l1-verifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ spec:
env:
- name: NODE_NO_WARNINGS
value: "1"
- name: DEBUG
value: "aztec:*"
- name: LOG_LEVEL
value: "debug"
- name: L1_CHAIN_ID
Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/prover-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ spec:
value: "{{ .Values.proverAgent.logLevel }}"
- name: LOG_JSON
value: "1"
- name: DEBUG
value: "{{ .Values.proverAgent.debug }}"
- name: PROVER_REAL_PROOFS
value: "{{ .Values.aztec.realProofs }}"
- name: PROVER_AGENT_COUNT
Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/prover-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ spec:
value: "{{ .Values.proverBroker.logLevel }}"
- name: LOG_JSON
value: "1"
- name: DEBUG
value: "{{ .Values.proverBroker.debug }}"
- name: PROVER_BROKER_POLL_INTERVAL_MS
value: "{{ .Values.proverBroker.pollIntervalMs }}"
- name: PROVER_BROKER_JOB_TIMEOUT_MS
Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/pxe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ spec:
value: "1"
- name: LOG_LEVEL
value: "{{ .Values.pxe.logLevel }}"
- name: DEBUG
value: "{{ .Values.pxe.debug }}"
- name: PXE_PROVER_ENABLED
value: "{{ .Values.aztec.realProofs }}"
ports:
Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/setup-l2-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ spec:
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait --l1-chain-id {{ .Values.ethereum.chainId }}
echo "L2 contracts initialized"
env:
- name: DEBUG
value: "aztec:*"
- name: LOG_LEVEL
value: "debug"
- name: NETWORK_PUBLIC
Expand Down
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/transaction-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ spec:
value: "1"
- name: LOG_LEVEL
value: "{{ .Values.bot.logLevel }}"
- name: DEBUG
value: "{{ .Values.bot.debug }}"
- name: BOT_PRIVATE_KEY
value: "{{ .Values.bot.botPrivateKey }}"
- name: BOT_TX_INTERVAL_SECONDS
Expand Down
10 changes: 3 additions & 7 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bootNode:
p2pUdpPort: 40400
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
debug: ""
coinbaseAddress: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
sequencer:
maxSecondsBetweenBlocks: 0
Expand Down Expand Up @@ -87,7 +87,7 @@ validator:
p2pUdpPort: 40400
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
debug: ""
sequencer:
maxSecondsBetweenBlocks: 0
minTxsPerBlock: 1
Expand Down Expand Up @@ -117,7 +117,7 @@ proverNode:
p2pUdpPort: 40400
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
debug: ""
proverAgent:
count: 0
pollIntervalMs: 1000
Expand All @@ -136,7 +136,6 @@ proverNode:

pxe:
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
replicas: 1
service:
nodePort: 8081
Expand All @@ -155,7 +154,6 @@ bot:
enabled: true
nodeUrl: ""
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:database"
replicas: 1
botPrivateKey: "0xcafe"
txIntervalSeconds: 24
Expand Down Expand Up @@ -216,7 +214,6 @@ proverAgent:
gke:
spotEnabled: false
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
bb:
hardwareConcurrency: ""
nodeSelector: {}
Expand All @@ -232,7 +229,6 @@ proverBroker:
jobMaxRetries: 3
dataDirectory: ""
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
nodeSelector: {}
resources: {}

Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/values/prover-node-with-agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ validator:
external: true

bootNode:
debug: "aztec:*,-aztec:avm_simulator:*,-aztec:world-state:database,discv5:*,-JsonProxy:*"
debug: "discv5:*"
validator:
disabled: true

Expand Down
1 change: 0 additions & 1 deletion spartan/releases/rough-rhino/aztec-spartan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ services:
- VALIDATOR_PRIVATE_KEY=${KEY}
- SEQ_PUBLISHER_PRIVATE_KEY=${KEY}
- L1_PRIVATE_KEY=${KEY}
- DEBUG=aztec:*,-aztec:avm_simulator*,-aztec:circuits:artifact_hash,-aztec:libp2p_service,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*
- LOG_LEVEL=debug
- AZTEC_PORT=${PORT}
- P2P_ENABLED=true
Expand Down
1 change: 0 additions & 1 deletion spartan/testnet-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Verbose logging on Aztec nodes should be enabled by default using the following

- `LOG_JSON=1`
- `LOG_LEVEL=debug`
- `DEBUG=discv5*,aztec:*,-aztec:avm_simulator*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*`

Deployments are initiated from CI by manually running the (_name pending_) workflow.

Expand Down
7 changes: 4 additions & 3 deletions yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,16 @@ test:

run-e2e:
ARG test
ARG log_level=""
ARG debug=""
FROM +end-to-end
RUN DEBUG=$debug yarn test $test
RUN DEBUG=$debug LOG_LEVEL=$log_level yarn test $test

prover-client-test:
FROM +build
ARG test
ARG debug=""
RUN cd prover-client && DEBUG=$debug yarn test $test
ARG log_level=""
RUN cd prover-client && LOG_LEVEL=$log_level yarn test $test

# NOTE: This is not in the end-to-end Earthfile as that is entirely LOCALLY commands that will go away sometime.
# Running this inside the main builder as the point is not to run this through dockerization.
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-faucet/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ resource "aws_ecs_task_definition" "aztec-faucet" {
value = "80"
},
{
name = "DEBUG",
value = "aztec:*"
name = "LOG_LEVEL",
value = "verbose"
},
{
name = "RPC_URL",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export { decodeFromAbi, encodeArguments, type AbiType } from '@aztec/foundation/
export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
export { sha256 } from '@aztec/foundation/crypto';
export { makeFetch } from '@aztec/foundation/json-rpc/client';
export { createDebugLogger, onLog, type DebugLogger } from '@aztec/foundation/log';
export { createDebugLogger, type DebugLogger } from '@aztec/foundation/log';
export { retry, retryUntil } from '@aztec/foundation/retry';
export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
export { sleep } from '@aztec/foundation/sleep';
Expand Down
1 change: 1 addition & 0 deletions yarn-project/aztec.js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
fs: false,
path: false,
url: false,
tty: false,
worker_threads: false,
buffer: require.resolve('buffer/'),
util: require.resolve('util/'),
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
ports:
- '${SANDBOX_PXE_PORT:-8080}:8080'
environment:
DEBUG: # Loaded from the user shell if explicitly set
LOG_LEVEL: # Loaded from the user shell if explicitly set
HOST_WORKDIR: '${PWD}' # Loaded from the user shell to show log files absolute path in host
ETHEREUM_HOST: http://ethereum:8545
L1_CHAIN_ID: 31337
Expand Down
9 changes: 3 additions & 6 deletions yarn-project/aztec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
"build:dev": "tsc -b --watch",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests",
"run:example:token": "DEBUG='aztec:*' node ./dest/examples/token.js"
"run:example:token": "LOG_LEVEL='verbose' node ./dest/examples/token.js"
},
"inherits": [
"../package.common.json"
Expand Down Expand Up @@ -55,16 +55,13 @@
"@aztec/telemetry-client": "workspace:^",
"@aztec/txe": "workspace:^",
"@aztec/types": "workspace:^",
"@opentelemetry/winston-transport": "^0.7.0",
"@types/chalk": "^2.2.0",
"abitype": "^0.8.11",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"koa": "^2.14.2",
"koa-router": "^12.0.0",
"viem": "^2.7.15",
"winston": "^3.10.0",
"winston-daily-rotate-file": "^4.7.1"
"viem": "^2.7.15"
},
"files": [
"dest",
Expand Down Expand Up @@ -117,4 +114,4 @@
"engines": {
"node": ">=18"
}
}
}
6 changes: 0 additions & 6 deletions yarn-project/aztec/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { type DebugLogger, type LogFn } from '@aztec/foundation/log';

import { Command } from 'commander';

import { setupConsoleJsonLog } from '../logging.js';
import { createSandbox } from '../sandbox.js';
import { github, splash } from '../splash.js';
import { aztecStartOptions } from './aztec_start_options.js';
Expand Down Expand Up @@ -39,11 +38,6 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge
startCmd.helpInformation = printAztecStartHelpText;

startCmd.action(async options => {
// setup json logging
if (['1', 'true', 'TRUE'].includes(process.env.LOG_JSON ?? '')) {
setupConsoleJsonLog();
}

// list of 'stop' functions to call when process ends
const signalHandlers: Array<() => Promise<void>> = [];
const services: NamespacedApiHandlers = {};
Expand Down
Loading
Loading