mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
37 lines
846 B
TypeScript
37 lines
846 B
TypeScript
/**
|
|
* General app logger (Electron main).
|
|
*
|
|
* Thin wrapper over the shared node-runtime appLogger so all runtimes write to
|
|
* the same rolling `logs/app.log`. Exported shape kept for existing call sites.
|
|
*/
|
|
|
|
import { initAppLogger, appLogger } from '@openchatlab/node-runtime'
|
|
import { getLogsDir } from './paths/locations'
|
|
|
|
let initialized = false
|
|
|
|
function ensureInit(): void {
|
|
if (initialized) return
|
|
initialized = true
|
|
initAppLogger(getLogsDir())
|
|
}
|
|
|
|
export const logger = {
|
|
info: (message: string) => {
|
|
ensureInit()
|
|
appLogger.info('app', message)
|
|
},
|
|
warn: (message: string) => {
|
|
ensureInit()
|
|
appLogger.warn('app', message)
|
|
},
|
|
error: (message: string) => {
|
|
ensureInit()
|
|
appLogger.error('app', message)
|
|
},
|
|
debug: (message: string) => {
|
|
ensureInit()
|
|
appLogger.debug('app', message)
|
|
},
|
|
}
|