mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-12-01 13:03:42 +08:00
30 lines
1.9 KiB
TypeScript
30 lines
1.9 KiB
TypeScript
import styles from 'ansi-styles'
|
||
import { app } from 'electron'
|
||
import logger from 'electron-log'
|
||
|
||
const color = (hex: string, text: string) => {
|
||
return `${styles.color.ansi(styles.hexToAnsi(hex))}${text}${
|
||
styles.color.close
|
||
}`
|
||
}
|
||
|
||
logger.transports.console.format = `${color(
|
||
'38bdf8',
|
||
'[main]'
|
||
)} {h}:{i}:{s}.{ms}{scope} › {text}`
|
||
|
||
logger.transports.file.level = app.isPackaged ? 'info' : 'debug'
|
||
logger.info(
|
||
color(
|
||
'335eea',
|
||
`\n\n██╗ ██╗███████╗███████╗██████╗ ██╗ █████╗ ██╗ ██╗███╗ ███╗██╗ ██╗███████╗██╗ ██████╗
|
||
╚██╗ ██╔╝██╔════╝██╔════╝██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝████╗ ████║██║ ██║██╔════╝██║██╔════╝
|
||
╚████╔╝ █████╗ ███████╗██████╔╝██║ ███████║ ╚████╔╝ ██╔████╔██║██║ ██║███████╗██║██║
|
||
╚██╔╝ ██╔══╝ ╚════██║██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██║╚██╔╝██║██║ ██║╚════██║██║██║
|
||
██║ ███████╗███████║██║ ███████╗██║ ██║ ██║ ██║ ╚═╝ ██║╚██████╔╝███████║██║╚██████╗
|
||
╚═╝ ╚══════╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝\n`
|
||
)
|
||
)
|
||
|
||
export default logger
|