aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/background/backend.js')
-rw-r--r--ext/js/background/backend.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index ccd828f6..f301b4c6 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -24,7 +24,8 @@ import {Mecab} from '../comm/mecab.js';
import {createApiMap, invokeApiMapHandler} from '../core/api-map.js';
import {ExtensionError} from '../core/extension-error.js';
import {fetchJson, fetchText} from '../core/fetch-utilities.js';
-import {log} from '../core/logger.js';
+import {logErrorLevelToNumber} from '../core/log-utilities.js';
+import {log} from '../core/log.js';
import {clone, deferPromise, isObject, promiseTimeout} from '../core/utilities.js';
import {isNoteDataValid} from '../data/anki-util.js';
import {OptionsUtil} from '../data/options-util.js';
@@ -172,7 +173,7 @@ export class Backend {
['getDictionaryInfo', this._onApiGetDictionaryInfo.bind(this)],
['purgeDatabase', this._onApiPurgeDatabase.bind(this)],
['getMedia', this._onApiGetMedia.bind(this)],
- ['log', this._onApiLog.bind(this)],
+ ['logGenericErrorBackend', this._onApiLogGenericErrorBackend.bind(this)],
['logIndicatorClear', this._onApiLogIndicatorClear.bind(this)],
['modifySettings', this._onApiModifySettings.bind(this)],
['getSettings', this._onApiGetSettings.bind(this)],
@@ -265,7 +266,7 @@ export class Backend {
}, 1000);
this._updateBadge();
- log.on('log', this._onLog.bind(this));
+ log.on('logGenericError', this._onLogGenericError.bind(this));
await this._requestBuilder.prepare();
await this._environment.prepare();
@@ -334,11 +335,11 @@ export class Backend {
}
/**
- * @param {{level: import('log').LogLevel}} params
+ * @param {import('log').Events['logGenericError']} params
*/
- _onLog({level}) {
- const levelValue = log.getLogErrorLevelValue(level);
- const currentLogErrorLevel = this._logErrorLevel !== null ? log.getLogErrorLevelValue(this._logErrorLevel) : 0;
+ _onLogGenericError({level}) {
+ const levelValue = logErrorLevelToNumber(level);
+ const currentLogErrorLevel = this._logErrorLevel !== null ? logErrorLevelToNumber(this._logErrorLevel) : 0;
if (levelValue <= currentLogErrorLevel) { return; }
this._logErrorLevel = level;
@@ -741,9 +742,9 @@ export class Backend {
return await this._getNormalizedDictionaryDatabaseMedia(targets);
}
- /** @type {import('api').ApiHandler<'log'>} */
- _onApiLog({error, level, context}) {
- log.log(ExtensionError.deserialize(error), level, context);
+ /** @type {import('api').ApiHandler<'logGenericErrorBackend'>} */
+ _onApiLogGenericErrorBackend({error, level, context}) {
+ log.logGenericError(ExtensionError.deserialize(error), level, context);
}
/** @type {import('api').ApiHandler<'logIndicatorClear'>} */