Girgetto / flogg

🚧The logger we use @ faable.com based in npm debug module

Home Page:https://faable.com/opensource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flogg - Faable logger for node

npm version npm install

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("@faable/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("@faable/flogg");
debug("¡Hi!");

This code will print if DEBUG env variable is set to api:*:

api:debug:miscroscope ¡Hi!

About

🚧The logger we use @ faable.com based in npm debug module

https://faable.com/opensource


Languages

Language:TypeScript 92.9%Language:JavaScript 7.1%