estoner
estoner

Reputation: 305

How do you turn on console logging in the Ember v2 router API?

In v1 of the router API, you could set this flag:

App.Router = Ember.Router.extend({
  enableLogging: true
});

And the router would log state changes to console.log, which was helpful for debugging. This doesn't seem to work anymore--does anyone know whether there's a new equivalent to this flag?

Upvotes: 4

Views: 1739

Answers (2)

adivis
adivis

Reputation: 638

Since 1bf0df4 commit:

App = Ember.Application.create({
  LOG_TRANSITIONS: true
});

Upvotes: 9

Han
Han

Reputation: 1293

I don't think this has yet to be worked out in the master branch, as far as I can tell: I have, however found a relevant comment in the source code:

/* For me this comment starts on line 23202 on build v1.0.0-pre.2-233-g2db13c3

In addition to creating your application's router, `Ember.Application` is
also responsible for telling the router when to start routing.

By default, the router will begin trying to translate the current URL into
application state once the browser emits the `DOMContentReady` event. If you
need to defer routing, you can call the application's `deferReadiness()`
method. Once routing can begin, call the `advanceReadiness()` method.

If there is any setup required before routing begins, you can implement a
`ready()` method on your app that will be invoked immediately before routing
begins:

window.App = Ember.Application.create({
  ready: function() {
    this.set('router.enableLogging', true);
  }
});

*/

Note that this comment is actually in the source code for the master branch which has already merged in the new routing changes. I would have to conclude that this is a bug, and will probably be worked out in the near future (hopefully).

Upvotes: 0

Related Questions