Singleton logging with levels
My very own Node.js logging library! Crazy that no one else thought of this first!
npm install loge --save
Or in your
import logger from 'loge';loggerlevel = 'error';loggerwarning'You should probably get a doctor to look at that.';// (nothing)loggercritical'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?
Loge's calls Node's
util.format (but only when the called method's level is greater than equal to the logger's
level), so the following interpolation variables are available:
%d- Number (integer / float)
%j- JSON (
JSON.stringify()called without replacer or indentation
%% for an escaped percent sign
import Level from 'loge';console.logLevelnotset;// 0console.logLeveldebug;// 10console.logLevel.info;// 20console.logLevelwarning;// 30console.logLevel.error;// 40console.logLevelcritical;// 50
Copyright © 2014-2015 Christopher Brown. MIT Licensed.