Skip to content

Commit

Permalink
Merge pull request #14854 from intercom/gj/debug-only-log-active-gene…
Browse files Browse the repository at this point in the history
…ration

[BUGFIX beta] only `LOG_ACTIVE_GENERATION` and `LOG_RESOLVER` in debug
  • Loading branch information
rwjblue authored Jan 20, 2017
2 parents 3c8a569 + 1e71e0c commit 9d23667
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
15 changes: 11 additions & 4 deletions packages/ember-application/lib/system/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
*/

import { dictionary } from 'ember-utils';
import { assert, info, get } from 'ember-metal';
import {
assert,
info,
get,
runInDebug
} from 'ember-metal';
import {
String as StringUtils,
Object as EmberObject,
Expand Down Expand Up @@ -171,9 +176,11 @@ export default EmberObject.extend({

resolved = resolved || this.resolveOther(parsedName);

if (parsedName.root && parsedName.root.LOG_RESOLVER) {
this._logLookup(resolved, parsedName);
}
runInDebug(() => {
if (parsedName.root && parsedName.root.LOG_RESOLVER) {
this._logLookup(resolved, parsedName);
}
});

if (resolved) {
validateType(resolved, parsedName);
Expand Down
11 changes: 7 additions & 4 deletions packages/ember-routing/lib/system/generate_controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
info,
get
get,
runInDebug
} from 'ember-metal';
import { FACTORY_FOR } from 'container';

Expand Down Expand Up @@ -48,9 +49,11 @@ export default function generateController(owner, controllerName) {
let fullName = `controller:${controllerName}`;
let instance = owner.lookup(fullName);

if (get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
info(`generated -> ${fullName}`, { fullName });
}
runInDebug(() => {
if (get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
info(`generated -> ${fullName}`, { fullName });
}
});

return instance;
}
8 changes: 5 additions & 3 deletions packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,11 @@ const EmberRouter = EmberObject.extend(Evented, {
routeOwner.register(fullRouteName, DefaultRoute.extend());
handler = routeOwner.lookup(fullRouteName);

if (get(this, 'namespace.LOG_ACTIVE_GENERATION')) {
info(`generated -> ${fullRouteName}`, { fullName: fullRouteName });
}
runInDebug(() => {
if (get(this, 'namespace.LOG_ACTIVE_GENERATION')) {
info(`generated -> ${fullRouteName}`, { fullName: fullRouteName });
}
});
}

handler._setRouteName(routeName);
Expand Down

0 comments on commit 9d23667

Please sign in to comment.