Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536
  1. // eslint-disable-next-line import/no-extraneous-dependencies
  2. const log = require('loglevel');
  3. // eslint-disable-next-line import/no-extraneous-dependencies
  4. const chalk = require('chalk');
  5. const prefix = require('../lib/loglevel-plugin-prefix');
  6. const colors = {
  7. TRACE: chalk.magenta,
  8. DEBUG: chalk.cyan,
  9. INFO: chalk.blue,
  10. WARN: chalk.yellow,
  11. ERROR: chalk.red,
  12. };
  13. prefix.reg(log);
  14. log.enableAll();
  15. prefix.apply(log, {
  16. format(level, name, timestamp) {
  17. return `${chalk.gray(`[${timestamp}]`)} ${colors[level.toUpperCase()](level)} ${chalk.green(`${name}:`)}`;
  18. },
  19. });
  20. prefix.apply(log.getLogger('critical'), {
  21. format(level, name, timestamp) {
  22. return chalk.red.bold(`[${timestamp}] ${level} ${name}:`);
  23. },
  24. });
  25. log.trace('trace');
  26. log.debug('debug');
  27. log.getLogger('critical').info('Something significant happened');
  28. log.log('log');
  29. log.info('info');
  30. log.warn('warn');
  31. log.error('error');