1.1.5 • Published 6 years ago
@faable/flogg v1.1.5
Flogg - Faable logger for node
Faable.com logger for node.js that uses debug module and customizes it for log file scoping.
How to use it
In package.json set the DEBUG env variable:
{
...
"scripts":{
"dev":"DEBUG=api:* node myapp.js"
}
...
}Then before doing anything require flog and set the log prefix:
const { setLog } = require("../dist/flogg");
// setLog should be called only once
setLog("api");In all other files, just require flogg and it will set automatically the log prefix based on filename. Example for a file named microscope.js:
const { debug } = require("../dist/flogg");
debug("¡Hi!");This code will print if DEBUG env variable is set to api:*:
api:debug:miscroscope ¡Hi!