OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/**
* loglevel 的极简替身。
*
* dxf-parser 依赖 loglevel 打调试日志,但它只用到 setLevel/debug/info/warn/error/trace
* 这几个方法。为了让 vendored 的 dxf-parser 原样能在浏览器里跑(不引入打包工具),
* index.html 的 importmap 把 "loglevel" 指到这里。
* 默认只放行 warn 及以上,避免解析大图时刷屏。
*/
const LEVELS = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, silent: 5 }
let level = LEVELS.warn
const emit = (name, consoleFn) => (...args) => {
if (LEVELS[name] < level) return
// dxf-parser 里有 '%s' 风格的格式串console 原生就支持
consoleFn.apply(console, args)
}
const log = {
levels: LEVELS,
setLevel(l) { level = typeof l === 'number' ? l : (LEVELS[String(l).toLowerCase()] ?? LEVELS.warn) },
getLevel() { return level },
getLogger() { return log },
trace: emit('trace', console.debug),
debug: emit('debug', console.debug),
info: emit('info', console.info),
warn: emit('warn', console.warn),
error: emit('error', console.error),
}
log.log = log.debug
export default log