murli2308
murli2308

Reputation: 3002

Disable Ember.Logger.log() in production build from code

I want to disable all the logs while building production build. I am using ember 2.5 latest version.

Upvotes: 1

Views: 1238

Answers (1)

TameBadger
TameBadger

Reputation: 1590

What I can think of for a quick solution is the following.

adding the following, to something like app.js or an initializer maybe

if(config.environment === 'production'){
  Ember.Logger.log = function(){}
}

and maybe going a bit further by adding an option to your config/environment.

  var ENV = {
    logging_active: false,
  ...,
  ...,
  }
  if (environment === 'development') {
    ENV.logging_active = true
  }

and then in your app

if(!config.logging_active){
  Ember.Logger.log = function(){}
}

Upvotes: 2

Related Questions