Loggin'JS {v1.x.x} Docs

NPM version NPM quality build status Downloads Dependencies Known Vulnerabilities

A little customizable logger for NodeJS.
Log to the console, to a file, to a remote service or create a custom one.

Quick Links: 🔗 .getLogger 🔗 Logger 🔗 Level 🔗 Channel 🔗 Formatter 🔗 Notifier 🔗 Options

Bump to v1.x

Bump to version v1.x is hopefully an improvement over the API an general cohesion of the library, hopefully you find it so!

!NOTICE! Api not compatible with v0.x


Docs & Community


npm install loggin-js --save
node run examples/basic-example.js



// Require the logging library
const logging = require('loggin-js');


Simple example

The easiest way of creating a logger is by using the .getLogger method.
It will return a logger based on the options passed, but let's make it simple for now.

By default it will return a console logger, with a level of DEBUG,
and the channel set to the current filename, the channel is just an identifier for the logger.

// You know the drill, import the lib
const loggin = require('loggin-js');

// Create a default logger
const logger = loggin.logger();

// Log a debug message
logger.debug('A cool message');

The above would output something like:

[2018-06-02 00:46:24 root] - example.js - DEBUG - A cool message

Configuring logger

Now let's see how you could configure our logger a bit. You can customize mostly every aspect of the logger, you can create custom Formatters, custom Notifier and change every important option after creating the logger.

For example we can create a custom Formatter that prints just the data we want:

const logger = loggin.logger();

const formatter = loggin.formatter('[{channel}] {message} - {data!json}');

We can also specify one or more notifiers, wich could log to a file, to the console, to a remote service or some other custom notifier:

const logger = loggin.logger();

const notifier = new loggin.Notifier.File(opts);
const notifier2 = new loggin.Notifier.Remote(opts);
logger.notifier(notifier, notifier2);

After creating the logger we can change most of the options, like the level, the channel, etc... For example:

const logger = loggin.logger();


logger.debug('A cool message');


Hi there, if you like the project don't hesitate in collaborating (if you like to), submit a pull request, post an issue, ...
It's just a little sideproject, nothing serius, so its just for fun!
But any help or ideas are apreciated!