Dashboard sipadu mbip
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. class Log {
  2. /**
  3. * Log basic info to the console.
  4. *
  5. * @param {String} message
  6. * @param {String} color
  7. */
  8. static info(message, color = 'default') {
  9. console.log(Log.colors()[color], message);
  10. Log.reset();
  11. }
  12. /**
  13. * Log feedback info to the console.
  14. *
  15. * @param {String} message
  16. * @param {String} color
  17. */
  18. static feedback(message, color = 'green') {
  19. Log.line('\t' + message, color);
  20. }
  21. /**
  22. * Log error info to the console.
  23. *
  24. * @param {String} message
  25. * @param {String} color
  26. */
  27. static error(message, color = 'red') {
  28. Log.line(message, color);
  29. }
  30. /**
  31. * Log a new line of info to the console.
  32. *
  33. * @param {String} message
  34. * @param {String} color
  35. */
  36. static line(message, color = 'default') {
  37. Log.info(message, color);
  38. }
  39. /**
  40. * Reset the default color for future console.logs.
  41. *
  42. * @param {String} message
  43. * @param {String} color
  44. */
  45. static reset() {
  46. console.log(Log.colors()['default'], '');
  47. }
  48. /**
  49. * The colors lookup table.
  50. */
  51. static colors() {
  52. return {
  53. default: '\x1b[0m',
  54. green: '\x1b[32m',
  55. red: '\x1b[31m'
  56. };
  57. }
  58. }
  59. module.exports = Log;