Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including loge with all npm packages installed. Try it out:

var loge = require("loge")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

loge v1.0.5

Singleton logging with levels


latest version published to npm

My very own Node.js logging library! Crazy that no one else thought of this first!

npm install --save loge

Basic use

The singleton Logger instance defaults to writing to process.stderr.

import {logger, Level} from 'loge'

logger.level = Level.error
logger.warning('You should probably get a doctor to look at that.')
// (nothing)
logger.critical('OMG your face I you what no really just does it hurt?')
// [critical] OMG your face I you what no really just does it hurt?

Alternatively, write to process.stdout:

import {Logger, Level} from 'loge'

const logger = new Logger(process.stdout,


Loge's calls Node's util.format (but only when the called method's level is greater than or equal to the logger's level), so the following interpolation variables are available:

  • %s - String
  • %d - Number (integer / float)
  • %j - JSON (JSON.stringify() called without replacer or indentation

Use %% for an escaped percent sign


import {Level} from 'loge'

// 0
// 10
// 20
// 30
// 40
// 50


Copyright © 2014-2015 Christopher Brown. MIT Licensed.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free