rsnext/packages/next/build/output/log.ts
Justin Chase 52dd42a6bb Do not clear the console (#6758)
* Do not clear the console

Its rude to clear the console, you may be sharing output with other processes even in tty mode.

* Remove unused dependency

* Dedupe and cleanup dev output without clearing

* use logError

* Remove exit handler

* Add next helper

* Add log helpers

* Switch store to log helpers and a shallow object compare

* Update other files to use new logging utility

* request => build

* Update ready on messages

* Use case insensitive matching
2019-04-09 11:52:03 -04:00

34 lines
800 B
TypeScript

import chalk from 'chalk'
const prefixes = {
wait: chalk`[ {cyan wait} ] `,
error: chalk`[ {red error} ]`,
warn: chalk`[ {yellow warn} ] `,
ready: chalk`[ {green ready} ]`,
info: chalk`[ {cyan {dim info}} ] `,
event: chalk`[ {magenta event} ]`,
}
export function wait(...message: string[]) {
console.log(prefixes.wait, ...message)
}
export function error(...message: string[]) {
console.log(prefixes.error, ...message)
}
export function warn(...message: string[]) {
console.log(prefixes.warn, ...message)
}
export function ready(...message: string[]) {
console.log(prefixes.ready, ...message)
}
export function info(...message: string[]) {
console.log(prefixes.info, ...message)
}
export function event(...message: string[]) {
console.log(prefixes.event, ...message)
}