How do I enable console logging in the Ember v2 API?

In the v1 router API, you can set this flag:

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

And the router will write state changes to console.log, which would be useful for debugging. This doesn't seem to work anymore - does anyone know if there is a new equivalent to this flag?

+4
source share
2 answers

Since 1bf0df4 commit:

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

I do not think that this has not yet been developed in the main branch, as far as I can tell: I found, however, a corresponding 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 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 `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 of the main branch, which has already been merged into new routing changes. I would have to conclude that this is a mistake, and probably it will be developed in the near future (I hope).

0
source

All Articles