Skip to content

Commit

Permalink
[BUGFIX beta] only LOG_TRANSITIONS and LOG_TRANSITIONS_INTERNAL in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinJoyce committed Jan 20, 2017
1 parent 9cbf9f3 commit 7c47fa8
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
defineProperty,
computed,
run,
runInDebug,
deprecate
} from 'ember-metal';
import {
Expand Down Expand Up @@ -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());
},
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7c47fa8

Please sign in to comment.