MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / initLog

Function initLog

src/common/logger.ts:4–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import eventBus from "./event-bus";
3
4export function initLog() {
5 logger.toast = (text: string) => {
6 eventBus.at("dispatch", "toast", text);
7 };
8 Object.assign(console, logger.functions);
9 const rawWarn = console.warn.bind(console);
10 console.warn = (...args: any[]) => {
11 const first = args[0];
12 const message =
13 typeof first === "string"
14 ? first
15 : first && typeof first.message === "string"
16 ? first.message
17 : "";
18 if (message.includes("[Baidu service]TIMEOUT")) {
19 return;
20 }
21 return rawWarn(...args);
22 };
23}
24export default logger;

Callers 2

background.tsFile · 0.90
constructorMethod · 0.90

Calls 1

bindMethod · 0.80

Tested by

no test coverage detected