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/app/content-script-main.js | 2 +- ext/js/app/frontend.js | 4 ++-- ext/js/app/popup-proxy.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/js/app') diff --git a/ext/js/app/content-script-main.js b/ext/js/app/content-script-main.js index a09e52ea..1c0c6d49 100644 --- a/ext/js/app/content-script-main.js +++ b/ext/js/app/content-script-main.js @@ -52,6 +52,6 @@ yomichan.ready(); } catch (e) { - yomichan.logError(e); + log.error(e); } })(); diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index 74cc63d2..02707f41 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -276,7 +276,7 @@ class Frontend { this._showExtensionUnloaded(textSource); } } else { - yomichan.logError(error); + log.error(error); } } if (type !== null) { this._stopClearSelectionDelayed(); @@ -563,7 +563,7 @@ class Frontend { ); this._lastShowPromise.catch((error) => { if (yomichan.isExtensionUnloaded) { return; } - yomichan.logError(error); + log.error(error); }); return this._lastShowPromise; } diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js index 19856e3f..63ecc254 100644 --- a/ext/js/app/popup-proxy.js +++ b/ext/js/app/popup-proxy.js @@ -201,7 +201,7 @@ class PopupProxy extends EventDispatcher { } this._frameOffsetUpdatedAt = now; } catch (e) { - yomichan.logError(e); + log.error(e); } finally { this._frameOffsetPromise = null; } -- cgit v1.2.3