log.js 629 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Logging utility
  2. const chalk = require('chalk')
  3. class Log {
  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. }
  29. module.exports = Log