import os from 'node:os'
import log from 'electron-log'
import { app } from './config'

log.transports.file.maxSize = 1002430
log.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'

// 需要保存的路径
log.transports.file.resolvePath = () => `${os.homedir()}\\Documents\\${app.name}.log`

// 全局的 console.info 写进日志文件
console.info = log.info

export default log
