From 7c47fa8109e7dd0cbdbc5ecb88161cb0dd370a9e Mon Sep 17 00:00:00 2001 From: Gavin Joyce Date: Fri, 20 Jan 2017 14:18:42 +0000 Subject: [PATCH] [BUGFIX beta] only LOG_TRANSITIONS and LOG_TRANSITIONS_INTERNAL in debug --- packages/ember-routing/lib/system/router.js | 35 +++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/ember-routing/lib/system/router.js b/packages/ember-routing/lib/system/router.js index 8b07f42cffa..3eafd45ef82 100644 --- a/packages/ember-routing/lib/system/router.js +++ b/packages/ember-routing/lib/system/router.js @@ -15,6 +15,7 @@ import { defineProperty, computed, run, + runInDebug, deprecate } from 'ember-metal'; import { @@ -106,9 +107,11 @@ const EmberRouter = EmberObject.extend(Evented, { } }); - if (get(this, 'namespace.LOG_TRANSITIONS_INTERNAL')) { - router.log = Logger.debug; - } + runInDebug(() => { + if (get(this, 'namespace').LOG_TRANSITIONS_INTERNAL)) { + router.log = Logger.debug; + } + }); router.map(dsl.generate()); }, @@ -265,9 +268,11 @@ const EmberRouter = EmberObject.extend(Evented, { // less surprising than didTransition being out of sync. run.once(this, this.trigger, 'didTransition'); - if (get(this, 'namespace').LOG_TRANSITIONS) { - Logger.log(`Transitioned into '${EmberRouter._routePath(infos)}'`); - } + runInDebug(() => { + if (get(this, 'namespace').LOG_TRANSITIONS) { + Logger.log(`Transitioned into '${EmberRouter._routePath(infos)}'`); + } + }); }, _setOutlets() { @@ -336,9 +341,11 @@ const EmberRouter = EmberObject.extend(Evented, { willTransition(oldInfos, newInfos, transition) { run.once(this, this.trigger, 'willTransition', transition); - if (get(this, 'namespace').LOG_TRANSITIONS) { - Logger.log(`Preparing to transition from '${EmberRouter._routePath(oldInfos)}' to '${EmberRouter._routePath(newInfos)}'`); - } + runInDebug(() => { + if (get(this, 'namespace').LOG_TRANSITIONS) { + Logger.log(`Preparing to transition from '${EmberRouter._routePath(oldInfos)}' to '${EmberRouter._routePath(newInfos)}'`); + } + }); }, handleURL(url) { @@ -392,10 +399,12 @@ const EmberRouter = EmberObject.extend(Evented, { updatePaths(this); - let infos = this.router.currentHandlerInfos; - if (get(this, 'namespace').LOG_TRANSITIONS) { - Logger.log(`Intermediate-transitioned into '${EmberRouter._routePath(infos)}'`); - } + runInDebug(() => { + let infos = this.router.currentHandlerInfos; + if (get(this, 'namespace').LOG_TRANSITIONS) { + Logger.log(`Intermediate-transitioned into '${EmberRouter._routePath(infos)}'`); + } + }); }, replaceWith() {