log.js 618 B

12345678910111213141516171819202122232425262728293031323334
  1. // Logging utility
  2. const chalk = require('chalk')
  3. module.exports = {
  4. info(message) {
  5. console.log(
  6. chalk.bgWhite.black(' INFO '),
  7. message.replace(/\n/g, '\n ')
  8. )
  9. },
  10. ok(message) {
  11. console.log(
  12. chalk.bgGreen.black(' OK '),
  13. chalk.green(message.replace(/\n/g, '\n '))
  14. )
  15. },
  16. warning(message) {
  17. console.log(
  18. chalk.bgYellow.black(' WARN '),
  19. chalk.yellow(message.replace(/\n/g, '\n '))
  20. )
  21. },
  22. critical(message) {
  23. console.log(
  24. chalk.bgRed.white(' CRIT '),
  25. chalk.red(message.replace(/\n/g, '\n '))
  26. )
  27. },
  28. }