/
githubmirror
/
lemon-agent
Обзор
Документация
Войти
/
githubmirror
/
lemon-agent
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/shared/src/logger.ts
26 строк
696 B
Felix Brockmeier
Add analytics app
02 авг 2023, 23:48
02 авг 2023, 23:48
d3bf65b
Код
Авторство
О чём код?
import log4js from 'log4js'; import path from 'path'; const getInvocationDirPath = (): string => { if (!require.main?.filename) throw new Error('Missing require.main.filename'); const invocationDirPath = path.resolve( path.dirname(require.main.filename), '../../..' ); if (!invocationDirPath) throw new Error('Missing invocation dir path'); return invocationDirPath; }; log4js.configure({ appenders: { execution: { type: 'file', filename: path.resolve(getInvocationDirPath(), 'data/execution.log'), }, }, categories: { default: { appenders: ['execution'], level: 'info' } }, }); const logger = log4js.getLogger('execution'); export default logger;