Skip to content

Commit

Permalink
chore: Remove debug and winston in favor of pino
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Dec 2, 2024
1 parent 752bc59 commit 141257b
Show file tree
Hide file tree
Showing 22 changed files with 461 additions and 595 deletions.
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 @@ -161,7 +161,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
5 changes: 1 addition & 4 deletions yarn-project/aztec/package.json
Original file line number Diff line number Diff line change
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
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
69 changes: 0 additions & 69 deletions yarn-project/aztec/src/logging.ts

This file was deleted.

2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/avm_proving.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function proveAndVerifyAvmTestContract(functionName: string, calldata: Fr[
const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));

// Then we prove.
const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, logger);
const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, internalLogger);
if (proofRes.status === BB_RESULT.FAILURE) {
internalLogger.error(`Proof generation failed: ${proofRes.reason}`);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/bb-prover/src/bb/execute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AvmCircuitInputs } from '@aztec/circuits.js';
import { sha256 } from '@aztec/foundation/crypto';
import { type LogFn, currentLevel as currentLogLevel } from '@aztec/foundation/log';
import { type DebugLogger, type LogFn } from '@aztec/foundation/log';
import { Timer } from '@aztec/foundation/timer';
import { type NoirCompiledCircuit } from '@aztec/types/noir';

Expand Down Expand Up @@ -493,7 +493,7 @@ export async function generateAvmProof(
pathToBB: string,
workingDirectory: string,
input: AvmCircuitInputs,
log: LogFn,
logger: DebugLogger,
): Promise<BBFailure | BBSuccess> {
// Check that the working directory exists
try {
Expand Down Expand Up @@ -550,11 +550,11 @@ export async function generateAvmProof(
avmHintsPath,
'-o',
outputPath,
currentLogLevel == 'debug' ? '-d' : currentLogLevel == 'verbose' ? '-v' : '',
logger.level === 'debug' || logger.level === 'trace' ? '-d' : logger.level === 'verbose' ? '-v' : '',
];
const timer = new Timer();
const logFunction = (message: string) => {
log(`AvmCircuit (prove) BB out - ${message}`);
logger.verbose(`AvmCircuit (prove) BB out - ${message}`);
};
const result = await executeBB(pathToBB, 'avm_prove', args, logFunction);
const duration = timer.ms();
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/prover/bb_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise<BBSuccess> {
logger.info(`Proving avm-circuit for ${input.functionName}...`);

const provingResult = await generateAvmProof(this.config.bbBinaryPath, workingDirectory, input, logger.verbose);
const provingResult = await generateAvmProof(this.config.bbBinaryPath, workingDirectory, input, logger);

if (provingResult.status === BB_RESULT.FAILURE) {
logger.error(`Failed to generate AVM proof for ${input.functionName}: ${provingResult.reason}`);
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"viem": "^2.7.15",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"winston": "^3.10.0",
"zod": "^3.23.8"
},
"devDependencies": {
Expand Down
16 changes: 1 addition & 15 deletions yarn-project/end-to-end/src/fixtures/logging.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { onLog } from '@aztec/aztec.js';

import { mkdirpSync } from 'fs-extra';
import { dirname } from 'path';
import * as winston from 'winston';

const { format, transports } = winston;

let metricsLoggerSet = false;

Expand All @@ -22,15 +17,6 @@ export function setupMetricsLogger(filename: string) {
return;
}
mkdirpSync(dirname(filename));
const logger = winston.createLogger({
level: 'debug',
format: format.combine(format.timestamp(), format.json()),
transports: [new transports.File({ filename })],
});
onLog((level, namespace, message, data) => {
if (data && data['eventName']) {
logger.log({ ...data, level, namespace, message });
}
});
// TODO(palla/log): Reenable or kill metrics logger
metricsLoggerSet = true;
}
4 changes: 4 additions & 0 deletions yarn-project/foundation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@
"@aztec/bb.js": "portal:../../barretenberg/ts",
"@koa/cors": "^5.0.0",
"@noble/curves": "^1.2.0",
"@opentelemetry/instrumentation-pino": "^0.44.0",
"bn.js": "^5.2.1",
"colorette": "^2.0.20",
"debug": "^4.3.4",
"detect-node": "^2.1.0",
"elliptic": "^6.5.4",
Expand All @@ -116,6 +118,8 @@
"lodash.clonedeepwith": "^4.5.0",
"memdown": "^6.1.1",
"pako": "^2.1.0",
"pino": "^9.5.0",
"pino-pretty": "^13.0.0",
"sha3": "^2.1.4",
"zod": "^3.23.8"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createDebugLogger } from '../../log/logger.js';
import { createDebugLogger } from '../../log/pino-logger.js';

/**
* A number generator which is used as a source of randomness in the system. If the SEED env variable is set, the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { format } from 'util';

import { createDebugLogger } from '../../log/logger.js';
import { createDebugLogger } from '../../log/pino-logger.js';
import { type ApiSchema, type ApiSchemaFor, schemaHasMethod } from '../../schemas/api.js';
import { defaultFetch } from './fetch.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/log/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './console.js';
export * from './debug.js';
export * from './logger.js';
export * from './pino-logger.js';
export * from './log_history.js';
export * from './log_fn.js';
Loading

0 comments on commit 141257b

Please sign in to comment.