Nitrogenous Polymorphic Molecule

npm

Need private packages and team management tools?Check out npm Orgs. »

loge

1.0.5 • Public • Published

loge

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, Level.info)

Formatting

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

Levels

import {Level} from 'loge'
 
console.log(Level.notset)
// 0
console.log(Level.debug)
// 10
console.log(Level.info)
// 20
console.log(Level.warning)
// 30
console.log(Level.error)
// 40
console.log(Level.critical)
// 50

License

Copyright © 2014-2015 Christopher Brown. MIT Licensed.

install

npm i loge

Downloadsweekly downloads

22

version

1.0.5

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability