Signale - Hackable console logger for Nodejs
Note: This post is over 8 years old. The information may be outdated.
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
Related Posts
Sublime Text Plugin nào cho lập trình viên Node.js
Hôm nay mình sẽ giới thiệu 1 số plugin cần có để lập trình Node.js trên Sublime.
Javascript Shorthands Tips
These Javascript shorthand tips will make your code look more cool and clean.
5 bí quyết viết JS conditionals tốt hơn
Trong Javascript, chúng ta phải sử dụng nhiều loại lệnh điều kiện (if ... else ...) khác nhau, sau đây là 5 bí quyết để viết lệnh if else nhanh hơn và chuyên nghiệp hơn.
Gio.js - 3D Globe Data Visualization
Gio.js là thư viện nguồn mở để visualization 3D globe, xây dựng dựa trên thư viện **Three.js**. Gio.js cực kỳ dễ sử dụng và dễ customize.

