Skip to content
The most simple logger imaginable
Branch: master
Clone or download

Latest commit

Latest commit afb5409 Mar 16, 2019


Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore First commit Jan 5, 2015
.npmignore chore: reduce size of npm package Mar 16, 2019
.travis.yml test(ci): test on newer Node.js versions Mar 16, 2019
LICENSE chore: bump copyright year Mar 16, 2019 docs: improve Mar 16, 2019
index.js Pass current level to prefix function Nov 24, 2016
package.json 1.4.1 Mar 16, 2019
test.js Merge branch 'master' into add/stderr-option Nov 24, 2016


A dead simple logger. Will log to STDOUT or STDERR depending on the chosen log level. It uses, console.warn and console.error and hence supports the same API.

Log levels supported: trace, debug, info, warn, error and fatal.

npm Build status js-standard-style


npm install console-log-level

Example usage

var log = require('console-log-level')({ level: 'info' })

log.trace('a') // will not do anything
log.debug('b') // will not do anything'c')  // will output 'c\n' on STDOUT
log.warn('d')  // will output 'd\n' on STDERR
log.error('e') // will output 'e\n' on STDERR
log.fatal('f') // will output 'f\n' on STDERR


Configure the logger by passing an options object:

var log = require('console-log-level')({
  prefix: function (level) {
    return new Date().toISOString()
  level: 'info'


A string to specify the log level. Defaults to info.


Specify this option if you want to set a prefix for all log messages. This must be a string or a function that returns a string.

Will get the level of the currently logged message as the first argument.


A boolean to log everything to stderr. Defauls to false.



You can’t perform that action at this time.