feat: add log function

This commit is contained in:
Gabe Yuan
2024-03-19 18:07:18 +08:00
parent 1d9e9c1b7d
commit 6e927473b9
24 changed files with 76 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
import { CACHE_NAME } from "../config";
import { browser } from "./browser";
import { apiBaiduLangdetect } from "../apis";
import { kissLog } from "./log";
/**
* 清除缓存数据
@@ -9,7 +10,7 @@ export const tryClearCaches = async () => {
try {
caches.delete(CACHE_NAME);
} catch (err) {
console.log("[clean caches]", err.message);
kissLog(err, "clean caches");
}
};
@@ -25,7 +26,7 @@ export const tryDetectLang = async (q, useRemote = false) => {
try {
lang = await apiBaiduLangdetect(q);
} catch (err) {
console.log("[detect lang remote]", err.message);
kissLog(err, "detect lang remote");
}
}
@@ -34,7 +35,7 @@ export const tryDetectLang = async (q, useRemote = false) => {
const res = await browser?.i18n?.detectLanguage(q);
lang = res?.languages?.[0]?.language;
} catch (err) {
console.log("[detect lang local]", err.message);
kissLog(err, "detect lang local");
}
}