signale
signale copied to clipboard
Included features from issue #56 - Global callback when log type is called
This fixes issue #56 you can now set global callbacks for logs which will be called once the logger function is called. The callback function will get the exact same data which the user used.
const {Signale} = require('signale');
const options = {
disabled: false,
interactive: false,
stream: process.stdout,
scope: 'custom',
types: {
remind: {
badge: '**',
color: 'yellow',
label: 'reminder',
done: (...msg) => {
// Do something with the logged message(s)
}
},
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.');
Calling custom.remind('Hello', ', I love cookies')
will get passed to the done
callback as ['Hello', ', I love cookies']
. You can then use it for whatever logging purposes.
Any update on this?