Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A node logger

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 circle.yml
Octocat-spinner-32 package.json


A Javascript logging utility supporting log levels and categories. It outputs nicely formatted console messages with no configuration


npm install noggin

Usage (CoffeeScript)

logger = require('noggin')
logger.setLogLevel(noggin.ALL) "Log level is now #{noggin.logLevelToString(noggin.ALL)}"
#2013-01-02T03:31:32.242Z [DEBUG] [logger] Log level is now DEBUG | INFO | WARN | ERROR | FATAL

logger.debug "WAT?! NO"
#2013-01-02T03:31:32.242Z [DEBUG] WAT?! NO

logger.error "Database message", 'database'
#2013-01-02T03:31:32.242Z [ERROR] [database] Database message

Category wrapped logger (CoffeeScript)

logger = require('noggin').forCategory('database')

logger.setLogLevel(noggin.ALL) "Log level for database category is now #{noggin.logLevelToString(noggin.ALL)}"
#2013-01-02T03:31:32.242Z [DEBUG] [database] Log level for database is now DEBUG | INFO | WARN | ERROR | FATAL

logger.error 'Database message'
#2013-01-02T03:31:32.242Z [ERROR] [database] Database message

Override the default formatter

logger = require('noggin')

#json output
logger.formatter = (msg, category, level)->
  msg =
    time: new Date()
    category: category
    level: level
    message: msg "This is a message", "sys"
#{"time":"2013-01-02T03:31:32.242Z","category":"sys","level":"INFO","message":"This is a message"}

Change output target

logger = require('noggin')

#post it somewhere
logger.output = (msg)->"http://localhost/logsink", msg)
Something went wrong with that request. Please try again.