1
0
mirror of https://github.com/tooot-app/app synced 2025-04-27 08:28:55 +02:00
tooot/src/startup/log.ts
2021-01-07 19:13:09 +01:00

38 lines
803 B
TypeScript

import chalk from 'chalk'
const ctx = new chalk.Instance({ level: 3 })
const log = (type: 'log' | 'warn' | 'error', func: string, message: string) => {
switch (type) {
case 'log':
console.log(
ctx.bgBlue.white.bold(' Start up ') +
' ' +
ctx.bgBlueBright.black(` ${func} `) +
' ' +
message
)
break
case 'warn':
console.warn(
ctx.bgYellow.white.bold(' Start up ') +
' ' +
ctx.bgYellowBright.black(` ${func} `) +
' ' +
message
)
break
case 'error':
console.error(
ctx.bgRed.white.bold(' Start up ') +
' ' +
ctx.bgRedBright.black(` ${func} `) +
' ' +
message
)
break
}
}
export default log