mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-12-12 20:33:43 +08:00
32 lines
2.2 KiB
TypeScript
32 lines
2.2 KiB
TypeScript
/** By default, it writes logs to the following locations:
|
||
* on Linux: ~/.config/{app name}/logs/{process type}.log
|
||
* on macOS: ~/Library/Logs/{app name}/{process type}.log
|
||
* on Windows: %USERPROFILE%\AppData\Roaming\{app name}\logs\{process type}.log
|
||
* @see https://www.npmjs.com/package/electron-log
|
||
*/
|
||
|
||
import log from 'electron-log'
|
||
import pc from 'picocolors'
|
||
import { isDev } from './utils'
|
||
|
||
Object.assign(console, log.functions)
|
||
log.variables.process = 'main'
|
||
if (log.transports.ipc) log.transports.ipc.level = false
|
||
log.transports.console.format = `${
|
||
isDev ? '' : pc.dim('{h}:{i}:{s}{scope} ')
|
||
}{level} › {text}`
|
||
log.transports.file.level = 'info'
|
||
|
||
log.info(
|
||
`\n\n██╗ ██╗███████╗███████╗██████╗ ██╗ █████╗ ██╗ ██╗███╗ ███╗██╗ ██╗███████╗██╗ ██████╗
|
||
╚██╗ ██╔╝██╔════╝██╔════╝██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝████╗ ████║██║ ██║██╔════╝██║██╔════╝
|
||
╚████╔╝ █████╗ ███████╗██████╔╝██║ ███████║ ╚████╔╝ ██╔████╔██║██║ ██║███████╗██║██║
|
||
╚██╔╝ ██╔══╝ ╚════██║██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██║╚██╔╝██║██║ ██║╚════██║██║██║
|
||
██║ ███████╗███████║██║ ███████╗██║ ██║ ██║ ██║ ╚═╝ ██║╚██████╔╝███████║██║╚██████╗
|
||
╚═╝ ╚══════╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝\n`
|
||
)
|
||
|
||
export default log
|
||
|
||
log.info(`[logger] logger initialized`)
|