1
0
mirror of https://github.com/balkian/simple-colourful-logger.git synced 2024-12-22 09:38:13 +00:00
Node.js simple logger
Go to file
J.Fernando Sánchez 3cdb192eae Less verbose
2013-06-04 12:24:34 +02:00
lib Less verbose 2013-06-04 12:24:34 +02:00
.gitignore First commit 2013-06-03 23:47:51 +02:00
package.json Less verbose 2013-06-04 12:24:34 +02:00
README.md First commit 2013-06-03 23:47:51 +02:00

GSI Logo Simple Colourful Logger

A simple logger originally designed for the Maia platform. It accepts arbitrary arguments and formats the input if it's not a string. As a plus, it keeps the padding, so the extra information printed doesn't break the indentation of the default console.log.

You can specify the name of the logger and the levels that should be displayed. By default, only the "log" level is enabled. Use 'all' to add all the logging levels.

var Logger = require('simple-colourful-logger').Logger;
logger = new Logger('my-name', ['debug','warn']);
logger.info('This is an error');
logger.debug('This is a debug', {foo: "bar", bar: "foo"});
logger.warn('This is a warning');

The result is the following:

01:52:41 [DEBUG][my-name] { foo: "bar",
                            bar: "foo }
01:52:42 [WARN] [my-name] This is a warning