meteor Logging Logging with log level variables


Example

Logging can often clutter up the console, so it's common to define log levels to control what detail of data is getting logged. A common pattern is to specify a log level variables.

var DEBUG = false;
var TRACE = false;
Template.landingPage.events({
  'click .selectItemButton':function(){
    TRACE && console.count('click .selectItemButton');

    Meteor.call('niftyAction', function(errorMessage, result){
        if(errorMessage){
            DEBUG && console.error(errorMessage);    
        }
    });
  }
});