diff --git a/src/chrome/chrome-connector-client.ts b/src/chrome/chrome-connector-client.ts index 79ffed25..f8ee1ca2 100644 --- a/src/chrome/chrome-connector-client.ts +++ b/src/chrome/chrome-connector-client.ts @@ -10,8 +10,8 @@ import { tap, } from 'rxjs' import { ChromeDAppClient } from './chrome-dapp-client' -import { Logger } from 'tslog' import { chromeLocalStore } from './helpers/chrome-local-store' +import { logger } from 'utils/logger' const chromeDAppClient = ChromeDAppClient() @@ -20,10 +20,6 @@ export const ChromeConnectorClient = () => { const subscriptions = new Subscription() const createConnector = () => { - const logger = new Logger({ - prettyLogTemplate: '{{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t', - minLevel: config.logLevel, - }) connector = ConnectorClient({ source: 'extension', target: 'wallet', diff --git a/src/pairing/pairing.tsx b/src/pairing/pairing.tsx index 7ed0f43c..3cc0249f 100644 --- a/src/pairing/pairing.tsx +++ b/src/pairing/pairing.tsx @@ -5,8 +5,8 @@ import { useEffect, useState } from 'react' import { chromeLocalStore } from 'chrome/helpers/chrome-local-store' import { ConnectorClient } from 'connector/connector-client' import { config } from 'config' -import { Logger } from 'tslog' import { ok } from 'neverthrow' +import { logger } from 'utils/logger' export const Paring = () => { const [pairingState, setPairingState] = useState< @@ -22,10 +22,7 @@ export const Paring = () => { target: 'wallet', signalingServerBaseUrl: config.signalingServer.baseUrl, isInitiator: config.webRTC.isInitiator, - logger: new Logger({ - prettyLogTemplate: '{{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t', - minLevel: config.logLevel, - }), + logger, }) chrome.storage.onChanged.addListener((changes, area) => { diff --git a/src/utils/logger.ts b/src/utils/logger.ts new file mode 100644 index 00000000..4c01056a --- /dev/null +++ b/src/utils/logger.ts @@ -0,0 +1,7 @@ +import { config } from 'config' +import { Logger } from 'tslog' + +export const logger = new Logger({ + prettyLogTemplate: '{{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t', + minLevel: config.logLevel, +})