Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Logging lib for Node.js that prints also module name and line number
tree: 69bd99636e

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


node-logger is a Node.js logging library that prints module name, current line number and also your messages :) Furthermore it gives you an option to print messages in color.


Download and add to your code:

var logger = require('node-logger').logger(module [, useColor]);

module is object defined automatically by nodejs. Don't bother with it, just always type module.


var logger = require('node-logger').logger(module);'Info message');
logger.debug('Debug message');
logger.warn('Warning message');
logger.error('Error message');
logger.trace('Trace message');

To print messages in color init logger with useColor set to true:

var logger = require('node-logger').logger(module, true);

Output samples

2010-10-02 20:39:03.570 INFO  main:5 - Info message
2010-10-02 20:39:03.588 DEBUG main:6 - Debug message
2010-10-02 20:39:03.589 WARN  main:7 - Warning message
2010-10-02 20:39:03.590 ERROR main:8 - Error message
2010-10-02 20:39:03.590 TRACE main:9 - Trace message

2010-10-02 20:59:12.496 INFO  my-modules/first:3 - Message from first module from line #3
2010-10-02 20:59:12.514 INFO  my-modules/second:10 - Message from second module from line #10
2010-10-02 20:59:12.515 INFO  fake-module-name:3 - Message from third module from line #3
2010-10-02 20:59:12.516 INFO  <unknown>:3 - Message from fourth module from line #3


Released under MIT License. Enjoy and Fork!

Something went wrong with that request. Please try again.