From f742d972171ee3df309542075ea058a13fe3b92f Mon Sep 17 00:00:00 2001 From: Gavin Joyce Date: Thu, 12 Jan 2017 16:45:42 +0000 Subject: [PATCH] [BUGFIX beta] only `logLibraryVersions` in debug mode --- .../lib/system/application.js | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/ember-application/lib/system/application.js b/packages/ember-application/lib/system/application.js index 7d6e0a81832..dfb25cf4a7b 100644 --- a/packages/ember-application/lib/system/application.js +++ b/packages/ember-application/lib/system/application.js @@ -10,7 +10,8 @@ import { libraries, isTesting, get, - run + run, + runInDebug } from 'ember-metal'; import { Namespace, @@ -339,7 +340,7 @@ const Application = Engine.extend({ } registerLibraries(); - logLibraryVersions(); + runInDebug(() => logLibraryVersions()); // Start off the number of deferrals at 1. This will be decremented by // the Application's own `boot` method. @@ -1050,23 +1051,25 @@ function registerLibraries() { } function logLibraryVersions() { - if (ENV.LOG_VERSION) { - // we only need to see this once per Application#init - ENV.LOG_VERSION = false; - let libs = libraries._registry; + runInDebug(() => { + if (ENV.LOG_VERSION) { + // we only need to see this once per Application#init + ENV.LOG_VERSION = false; + let libs = libraries._registry; - let nameLengths = libs.map(item => get(item, 'name.length')); + let nameLengths = libs.map(item => get(item, 'name.length')); - let maxNameLength = Math.max.apply(this, nameLengths); + let maxNameLength = Math.max.apply(this, nameLengths); - debug('-------------------------------'); - for (let i = 0; i < libs.length; i++) { - let lib = libs[i]; - let spaces = new Array(maxNameLength - lib.name.length + 1).join(' '); - debug([lib.name, spaces, ' : ', lib.version].join('')); + debug('-------------------------------'); + for (let i = 0; i < libs.length; i++) { + let lib = libs[i]; + let spaces = new Array(maxNameLength - lib.name.length + 1).join(' '); + debug([lib.name, spaces, ' : ', lib.version].join('')); + } + debug('-------------------------------'); } - debug('-------------------------------'); - } + }); } export default Application;