tink
Lightweight helper to logging errors your project in node.js
Constructor
const Tink = require('tink');
var tink = new Tink(options);
- options - object of configuration
- bright - Colors brightening,
true
orfalse
- showtime - Showing time of write line. Time format (below) or
false
- logfile - Saving logs to file. Path or
false
- bright - Colors brightening,
Using
tink.success('Success!'); //green
tink.warn('Warning!'); //yellow
tink.warn('Error!'); //red
tink.note('Note.'); //white
tink.info('Information.'); //cyan
/*
Example line in console:
[2017-06-09 18:00:00] Success!
Example line in log file:
[success][2017-06-09 18:00:00] Success!
*/
var addons = ['ID#100', 'Mode: 1'];
tink.info('Hello World!', addons); //Show: [2017-06-09 18:00:00][ID#100][Mode: 1] Hello World!
Time formats
- YYYY - Full year, e.g. 2017
- YY - Year in two digits, e.g. 17
- MM - Month, e.g. 07
- DD - Full year, e.g. 20
- hh - Hours, e.g. 17
- mm - Minutes, e.g. 57
- ss - Seconds, e.g. 32
- ms - Milliseconds, e.g. 627
var tink = new Tink({
showtime: 'hh:mm:ss.ms DD-MM-YYYY',
logfile: 'YYYY-MM-DD hh_mm.log'
});