Signale - Hackable console logger for Nodejs

Signale là một thư viện thay thế console logger trong Nodejs, cho kết quả đẹp, sexy hơn và nhiều chức năng.

Cài đặt

npm install signale

Import và sử dụng như console.*

const signale = require('signale');

signale.success('Operation successful');
signale.debug('Hello', 'from', 'L59');
signale.pending('Write release notes for %s', '1.2.0');
signale.fatal(new Error('Unable to acquire lock'));
signale.watch('Recursively watching build directory...');
signale.complete({
  prefix: '[task]',
  message: 'Fix issue #59',
  suffix: '(@klauscfhq)',
});

Custom Loggers

Bạn có thể custom rất nhiều cho logger, bao gồm định nghĩa thêm phương thức log mới:

const { Signale } = require('signale');

const options = {
  disabled: false,
  interactive: false,
  stream: process.stdout,
  scope: 'custom',
  types: {
    remind: {
      badge: '**',
      color: 'yellow',
      label: 'reminder',
    },
    santa: {
      badge: '🎅',
      color: 'red',
      label: 'santa',
    },
  },
};

const custom = new Signale(options);
custom.remind('Improve documentation.');
custom.santa('Hoho! You have an unused variable on L45.');

Xem thêm chi tiết và cấu hình tham số tại đây: https://github.com/klauscfhq/signale

WebNodejsLoggerintro-jsJavascriptIntro-library