()
| 2 | import eventBus from "./event-bus"; |
| 3 | |
| 4 | export 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 | } |
| 24 | export default logger; |
no test coverage detected