YesPlayMusic/src/main/logger.ts

22 lines
1.8 KiB
TypeScript
Raw Normal View History

2022-03-13 14:40:38 +08:00
import { app } from 'electron'
import logger from 'electron-log'
import pc from 'picocolors'
2022-03-13 14:40:38 +08:00
2022-04-02 00:45:20 +08:00
Object.assign(console, logger.functions)
logger.transports.console.format = `${pc.dim('{h}:{i}:{s}{scope}')} {text}`
2022-03-13 14:40:38 +08:00
logger.transports.file.level = app.isPackaged ? 'info' : 'debug'
logger.info(
`\n\n██╗ ██╗███████╗███████╗██████╗ ██╗ █████╗ ██╗ ██╗███╗ ███╗██╗ ██╗███████╗██╗ ██████╗
2022-03-13 14:40:38 +08:00
\n`
)
export default logger
2022-04-02 00:45:20 +08:00
logger.info(`[logger] logger initialized`)