xpl / ololog

A better console.log for the log-driven debugging junkies
https://www.npmjs.com/package/ololog
The Unlicense
215 stars 8 forks source link

How to permanently reconfigure #11

Closed ourarash closed 5 years ago

ourarash commented 5 years ago

Suppose I configure the log once. How can I reconfigure it afterwards such that the effect stays permanent. See example below:

var log = require("ololog").configure({
  locate: false,
  tag:false
});

log("doesn't print locate or tag :)");

log.configure({locate:true, tag: true});

log.info("doesn't print locate or tag despite configure :("); 

log.configure({locate:true, tag: true}).info("prints locate or tag but it's ugly!"); 
kroitor commented 5 years ago

// configure

var log = require("ololog").configure({
  locate: false,
  tag:false
});

log("doesn't print locate or tag :)");

// reconfigure 

log = log.configure({locate:true, tag: true});

log.info("does print locate or tag :)"); 

log.configure({locate:true, tag: true}).info("prints locate or tag but it's ugly!"); 
ourarash commented 5 years ago

Awesome!