-
Notifications
You must be signed in to change notification settings - Fork 5
fix: replaced console logs with logger in adapters and agents #619
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,14 @@ | ||
| import { EverclearError, delay, domainToChainId, parseHostname, ERC20Abi } from '@chimera-monorepo/utils'; | ||
| import { EverclearError, Logger, delay, domainToChainId, parseHostname, ERC20Abi } from '@chimera-monorepo/utils'; | ||
| import { chainWrapper, type PublicClient } from '@chimera-monorepo/utils'; | ||
|
|
||
| const ethProviderLogger = new Logger({ | ||
| level: 'debug', | ||
| name: 'eth-provider', | ||
| formatters: { | ||
| level: (label) => ({ level: label.toUpperCase() }), | ||
| }, | ||
| }); | ||
|
|
||
| import { parseError, RpcError, ServerError, StallTimeout } from '../../errors'; | ||
| import { ISigner, ReadTransaction, WriteTransaction, ITransactionReceipt, ITransactionResponse, IBlock } from '../../types'; | ||
|
Comment on lines
+4
to
13
|
||
| import { RpcProvider } from '..'; | ||
|
|
@@ -144,7 +152,7 @@ class BaseSyncProvider { | |
| try { | ||
| sendTimestamp = Date.now(); | ||
| this.cpsTimestamps.push(sendTimestamp); | ||
| console.log(`=== ETH PROVIDER SEND called with method: ${method}, domain: ${this.domain}, params:`, params); | ||
| this.debugLog('ETH_PROVIDER_SEND', method, this.domain, params); | ||
| return await Promise.race( | ||
| [ | ||
| new Promise(async (resolve, reject) => { | ||
|
|
@@ -248,8 +256,7 @@ class BaseSyncProvider { | |
|
|
||
| private debugLog(message: string, ...args: unknown[]) { | ||
| if (this.debugLogging) { | ||
| // eslint-disable-next-line | ||
| console.log(`[${Date.now()}]`, `(${this.name})`, message, ...args); | ||
| ethProviderLogger.debug(`(${this.name}) ${message}`, undefined, undefined, { args }); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger.errorsetserrorfrom its 4th argument and overwrites anyctx.error. Because the 4th argument isundefinedhere, the Redis error won’t be captured. PassjsonifyError(err as Error)as the 4th param (and keep extra fields in the final context param).