Skip to content

Windslash/log.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log.js

Light-weight logging for NodeJS.

Installation

$ npm install log

Example

Log level defaults to DEBUG however here we specify INFO, and the stream defaults to stdout:

var Log = require('log')
  , log = new Log(Log.INFO);

log.debug('preparing email');
log.info('sending email');
log.error('failed to send email');

Specifying a specific stream:

var fs = require('fs')
  , Log = require('log')
  , log = new Log(Log.DEBUG, fs.createWriteStream('my.log'));

Instead of the log level constants, you may also supply a string:

var Log = require('log')
  , log = new Log('warning');

Log Levels

Mirror that of syslog:

  • 0 EMERGENCY system is unusable
  • 1 ALERT action must be taken immediately
  • 2 CRITICAL the system is in critical condition
  • 3 ERROR error condition
  • 4 WARNING warning condition
  • 5 NOTICE a normal but significant condition
  • 6 INFO a purely informational message
  • 7 DEBUG messages to debug an application

About

super light-weight nodejs logging + streaming log reader

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%