1
0
mirror of https://github.com/osmarks/random-stuff synced 2024-10-09 10:20:41 +00:00
random-stuff/log.ts

11 lines
428 B
TypeScript
Raw Normal View History

2020-08-12 19:31:12 +00:00
import chalk from "chalk"
import { format } from "date-fns"
const rawLog = (level, main) => {
const timestamp = format(new Date(), "HH:mm:ss")
console.log(chalk`{bold ${timestamp}} ${level} ${main}`)
}
export const info = x => rawLog(chalk.black.bgBlueBright("INFO"), x)
export const warning = x => rawLog(chalk.black.bgKeyword("orange")("WARN"), x)
export const error = x => rawLog(chalk.black.bgRedBright("FAIL"), x)