diff --git a/yarn-project/acir-simulator/src/acvm/acvm.ts b/yarn-project/acir-simulator/src/acvm/acvm.ts index d6d9ed81e8a..f5cbc795882 100644 --- a/yarn-project/acir-simulator/src/acvm/acvm.ts +++ b/yarn-project/acir-simulator/src/acvm/acvm.ts @@ -85,7 +85,7 @@ export async function acvm( const result = await oracleFunction.call(callback, ...args); return [result]; } catch (err: any) { - logger(`Error in oracle callback ${name}: ${err.message ?? err ?? 'Unknown'}`); + logger.error(`Error in oracle callback ${name}: ${err.message ?? err ?? 'Unknown'}`); throw err; } }); diff --git a/yarn-project/acir-simulator/src/client/simulator.ts b/yarn-project/acir-simulator/src/client/simulator.ts index e1281dc003d..b177dad2941 100644 --- a/yarn-project/acir-simulator/src/client/simulator.ts +++ b/yarn-project/acir-simulator/src/client/simulator.ts @@ -48,7 +48,7 @@ export class AcirSimulator { } if (request.origin !== contractAddress) { - this.log(`WARN: Request origin does not match contract address in simulation`); + this.log.warn('Request origin does not match contract address in simulation'); } const curve = await Grumpkin.new(); diff --git a/yarn-project/acir-simulator/src/client/unconstrained_execution.ts b/yarn-project/acir-simulator/src/client/unconstrained_execution.ts index bc5d36b3fe0..dcd5b45af6d 100644 --- a/yarn-project/acir-simulator/src/client/unconstrained_execution.ts +++ b/yarn-project/acir-simulator/src/client/unconstrained_execution.ts @@ -59,7 +59,7 @@ export class UnconstrainedFunctionExecution { storageRead: async ([slot], [numberOfElements]) => { if (!aztecNode) { const errMsg = `Aztec node is undefined, cannot read storage`; - this.log(errMsg); + this.log.error(errMsg); throw new Error(errMsg); } diff --git a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts index 140d757a7f1..dc9a835c70d 100644 --- a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts +++ b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts @@ -132,7 +132,7 @@ export class Synchroniser { this.synchedToBlock = latestBlock.block.number; } catch (err) { - this.log(err); + this.log.error(err); await this.interruptableSleep.sleep(retryInterval); } } @@ -186,7 +186,7 @@ export class Synchroniser { this.noteProcessors.push(noteProcessor); } } catch (err) { - this.log(err); + this.log.error(err); await this.interruptableSleep.sleep(retryInterval); } } diff --git a/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts b/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts index 909ed1b4f1a..32888a67486 100644 --- a/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts +++ b/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts @@ -82,6 +82,6 @@ main() process.exit(0); }) .catch(err => { - logger('Error in main fn: ', err); + logger.error('Error in main fn: ', err); process.exit(1); }); diff --git a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts index 2fa27813c68..d7ef5a620e1 100644 --- a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts +++ b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts @@ -333,6 +333,6 @@ main() process.exit(0); }) .catch(err => { - logger('Error in main fn: ', err); + logger.error('Error in main fn: ', err); process.exit(1); }); diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index be7fb9c51cf..b157e5d8779 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -49,7 +49,7 @@ const { SANDBOX_URL = '' } = process.env; export const waitForRPCServer = async (rpcServer: AztecRPC, logger: DebugLogger) => { await retryUntil(async () => { try { - logger('Attmpting to contact RPC Server...'); + logger('Attempting to contact RPC Server...'); await rpcServer.getNodeInfo(); return true; } catch (error) { diff --git a/yarn-project/foundation/src/fifo/bounded_serial_queue.ts b/yarn-project/foundation/src/fifo/bounded_serial_queue.ts index 035ce6eee98..79e83d19e0c 100644 --- a/yarn-project/foundation/src/fifo/bounded_serial_queue.ts +++ b/yarn-project/foundation/src/fifo/bounded_serial_queue.ts @@ -71,7 +71,7 @@ export class BoundedSerialQueue { } }) .catch(err => { - this.log('BoundedSerialQueue handler exception:', err); + this.log.error('BoundedSerialQueue handler exception:', err); }); } diff --git a/yarn-project/foundation/src/fifo/memory_fifo.ts b/yarn-project/foundation/src/fifo/memory_fifo.ts index 6053df46a27..c6233075dae 100644 --- a/yarn-project/foundation/src/fifo/memory_fifo.ts +++ b/yarn-project/foundation/src/fifo/memory_fifo.ts @@ -108,7 +108,7 @@ export class MemoryFifo { await handler(item); } } catch (err) { - this.log('Queue handler exception:', err); + this.log.error('Queue handler exception:', err); } } } diff --git a/yarn-project/foundation/src/json-rpc/server/json_rpc_server.ts b/yarn-project/foundation/src/json-rpc/server/json_rpc_server.ts index f217fee70dc..36212c1c310 100644 --- a/yarn-project/foundation/src/json-rpc/server/json_rpc_server.ts +++ b/yarn-project/foundation/src/json-rpc/server/json_rpc_server.ts @@ -38,14 +38,14 @@ export class JsonRpcServer { try { await next(); } catch (err: any) { - this.log(err); + this.log.error(err); ctx.status = 400; ctx.body = { error: err.message }; } }; const app = new Koa(); app.on('error', error => { - this.log(`KOA app-level error. ${convertBigintsInObj({ error })}`); + this.log.error(`KOA app-level error. ${JSON.stringify({ error })}`); }); app.use(compress({ br: false } as any)); app.use(bodyParser()); diff --git a/yarn-project/foundation/src/retry/index.ts b/yarn-project/foundation/src/retry/index.ts index 37200bef6d9..2aea88749ab 100644 --- a/yarn-project/foundation/src/retry/index.ts +++ b/yarn-project/foundation/src/retry/index.ts @@ -62,7 +62,7 @@ export async function retry( throw err; } log(`${name} failed. Will retry in ${s}s...`); - log(err); + log.error(err); await sleep(s * 1000); continue; } diff --git a/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts b/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts index 909dd134dfb..743840fe217 100644 --- a/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts +++ b/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts @@ -251,7 +251,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree { resolve(); }) .on('error', function () { - log('stream error'); + log.error('stream error'); reject(); }); }); diff --git a/yarn-project/p2p-bootstrap/src/index.ts b/yarn-project/p2p-bootstrap/src/index.ts index 91a83afb2b0..3b1ccc3080d 100644 --- a/yarn-project/p2p-bootstrap/src/index.ts +++ b/yarn-project/p2p-bootstrap/src/index.ts @@ -25,5 +25,5 @@ async function main() { } main().catch(err => { - logger(err); + logger.error(err); }); diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index 9abbe7e0862..6f9ea3a1491 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -215,7 +215,7 @@ export class LibP2PService implements P2PService { } await this.processMessage(message, peer); } catch (err) { - this.logger( + this.logger.error( `Failed to handle received message from peer ${incomingStreamData.connection.remotePeer.toString()}`, err, ); @@ -274,7 +274,7 @@ export class LibP2PService implements P2PService { } await this.sendGetTransactionsMessageToPeer(txHashes, peerId); } catch (err) { - this.logger(`Failed to process received tx hashes`, err); + this.logger.error(`Failed to process received tx hashes`, err); } } @@ -290,7 +290,7 @@ export class LibP2PService implements P2PService { } await this.sendTransactionsMessageToPeer(txs, peerId); } catch (err) { - this.logger(`Failed to process get txs request`, err); + this.logger.error(`Failed to process get txs request`, err); } } @@ -303,7 +303,7 @@ export class LibP2PService implements P2PService { await this.processTxFromPeer(tx, peerId); } } catch (err) { - this.logger(`Failed to process pooled transactions message`, err); + this.logger.error(`Failed to process pooled transactions message`, err); } } @@ -332,7 +332,7 @@ export class LibP2PService implements P2PService { await this.sendRawMessageToPeer(payload, peer); this.knownTxLookup.addPeerForTx(peer, txHashString); } catch (err) { - this.logger(`Failed to send txs to peer ${peer.toString()}`, err); + this.logger.error(`Failed to send txs to peer ${peer.toString()}`, err); continue; } } @@ -347,7 +347,7 @@ export class LibP2PService implements P2PService { const message = createTransactionHashesMessage(hashes); await this.sendRawMessageToPeer(new Uint8Array(message), peer); } catch (err) { - this.logger(`Failed to send tx hashes to peer ${peer.toString()}`, err); + this.logger.error(`Failed to send tx hashes to peer ${peer.toString()}`, err); } } @@ -356,7 +356,7 @@ export class LibP2PService implements P2PService { const message = createGetTransactionsRequestMessage(hashes); await this.sendRawMessageToPeer(new Uint8Array(message), peer); } catch (err) { - this.logger(`Failed to send tx request to peer ${peer.toString()}`, err); + this.logger.error(`Failed to send tx request to peer ${peer.toString()}`, err); } } diff --git a/yarn-project/rollup-provider/src/app.ts b/yarn-project/rollup-provider/src/app.ts index 453960d6d90..f2efa9e8bf1 100644 --- a/yarn-project/rollup-provider/src/app.ts +++ b/yarn-project/rollup-provider/src/app.ts @@ -31,7 +31,7 @@ export function appFactory(node: AztecNode, prefix: string) { try { await next(); } catch (err: any) { - logger(err); + logger.error(err); ctx.status = 400; ctx.body = { error: err.message }; } @@ -258,7 +258,7 @@ export function appFactory(node: AztecNode, prefix: string) { const app = new Koa(); app.on('error', error => { - logger(`KOA app-level error. ${JSON.stringify({ error })}`); + logger.error(`KOA app-level error. ${JSON.stringify({ error })}`); }); app.proxy = true; app.use(exceptionHandler); diff --git a/yarn-project/rollup-provider/src/index.ts b/yarn-project/rollup-provider/src/index.ts index a9b431e8e9f..b64dcd6b306 100644 --- a/yarn-project/rollup-provider/src/index.ts +++ b/yarn-project/rollup-provider/src/index.ts @@ -35,6 +35,6 @@ async function main() { } main().catch(err => { - logger(err); + logger.error(err); process.exit(1); }); diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts index 4b0ca9d8ee6..6100d7b87b4 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts @@ -223,7 +223,7 @@ export class L1Publisher implements L2BlockReceiver { try { return await this.txSender.sendEmitContractDeploymentTx(l2BlockNum, l2BlockHash, contractData); } catch (err) { - this.log(`Error sending contract data to L1`, err); + this.log.error(`Error sending contract data to L1`, err); await this.sleepOrInterrupted(); } } @@ -234,7 +234,7 @@ export class L1Publisher implements L2BlockReceiver { try { return await this.txSender.getTransactionReceipt(txHash); } catch (err) { - //this.log(`Error getting tx receipt`, err); + //this.log.error(`Error getting tx receipt`, err); await this.sleepOrInterrupted(); } } diff --git a/yarn-project/sequencer-client/src/sequencer/public_processor.ts b/yarn-project/sequencer-client/src/sequencer/public_processor.ts index 19e1d29b691..eacdac37579 100644 --- a/yarn-project/sequencer-client/src/sequencer/public_processor.ts +++ b/yarn-project/sequencer-client/src/sequencer/public_processor.ts @@ -105,7 +105,7 @@ export class PublicProcessor { try { result.push(await this.processTx(tx)); } catch (err) { - this.log(`Error processing tx ${await tx.getTxHash()}: ${err}`); + this.log.error(`Error processing tx ${await tx.getTxHash()}: ${err}`); failed.push(tx); } } diff --git a/yarn-project/types/src/l2_block_downloader/l2_block_downloader.ts b/yarn-project/types/src/l2_block_downloader/l2_block_downloader.ts index 7d7b6085ba5..37ddc85650f 100644 --- a/yarn-project/types/src/l2_block_downloader/l2_block_downloader.ts +++ b/yarn-project/types/src/l2_block_downloader/l2_block_downloader.ts @@ -53,7 +53,7 @@ export class L2BlockDownloader { this.queue.put(blocks); this.from += blocks.length; } catch (err) { - log(err); + log.error(err); await this.interruptableSleep.sleep(this.pollIntervalMS); } } diff --git a/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts b/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts index 0270e194c58..ce4e592d7cd 100644 --- a/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts +++ b/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts @@ -145,7 +145,7 @@ describe('server_world_state_synchroniser', () => { nextBlocks = [getMockBlock(currentBlockNumber + 1)]; // start the sync process but don't await - server.start().catch(err => log('Sync not completed: ', err)); + server.start().catch(err => log.error('Sync not completed: ', err)); // now setup a loop to monitor the sync progress and push new blocks in while (currentBlockNumber <= LATEST_BLOCK_NUMBER) {