From 9279ced68660610764931da681f22c8b71bf1b6e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 14 Feb 2021 17:52:01 -0500 Subject: Log refactoring (#1393) * Create Logger class and log instance * Replace yomichan.logWarning with log.warn * Replace yomichan.logError with log.error * Replace yomichan.log with log.log * Update the Yomichan class to use the global log object * Update lint rules --- ext/js/background/backend.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/js/background') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 69c90aca..698724fc 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -204,7 +204,7 @@ class Backend { try { await this._dictionaryDatabase.prepare(); } catch (e) { - yomichan.logError(e); + log.error(e); } const deinflectionReasions = await this._fetchAsset('/data/deinflect.json', true); @@ -226,7 +226,7 @@ class Backend { this._sendMessageAllTabsIgnoreResponse('backendReady', {}); this._sendMessageIgnoreResponse({action: 'backendReady', params: {}}); } catch (e) { - yomichan.logError(e); + log.error(e); throw e; } finally { if (this._badgePrepareDelayTimer !== null) { @@ -358,7 +358,7 @@ class Backend { forwardPort.onDisconnect.addListener(cleanup); } catch (e) { port.disconnect(); - yomichan.logError(e); + log.error(e); } } @@ -612,7 +612,7 @@ class Backend { } _onApiLog({error, level, context}) { - yomichan.log(deserializeError(error), level, context); + log.log(deserializeError(error), level, context); } _onApiLogIndicatorClear() { -- cgit v1.2.3