stuff
This commit is contained in:
25
buildfiles/app/node_modules/logform/examples/volume.js
generated
vendored
Normal file
25
buildfiles/app/node_modules/logform/examples/volume.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
const { format } = require('../');
|
||||
|
||||
const volume = format((info, opts) => {
|
||||
if (opts.yell) {
|
||||
info.message = info.message.toUpperCase();
|
||||
} else if (opts.whisper) {
|
||||
info.message = info.message.toLowerCase();
|
||||
}
|
||||
|
||||
return info;
|
||||
});
|
||||
|
||||
// `volume` is now a function that returns instances of the format.
|
||||
const scream = volume({ yell: true });
|
||||
console.dir(scream.transform({
|
||||
level: 'info',
|
||||
message: `sorry for making you YELL in your head!`
|
||||
}, scream.options));
|
||||
|
||||
// `volume` can be used multiple times to create different formats.
|
||||
const whisper = volume({ whisper: true });
|
||||
console.dir(whisper.transform({
|
||||
level: 'info',
|
||||
message: `WHY ARE THEY MAKING US YELL SO MUCH!`
|
||||
}, whisper.options));
|
||||
Reference in New Issue
Block a user