Skip to content

[BUGFIX beta] Refactor deprecations to have a private log level API#11419

Merged
mixonic merged 1 commit intoemberjs:masterfrom
mixonic:raise-on-deprecation-no-dont-actually-raise
Jun 11, 2015
Merged

[BUGFIX beta] Refactor deprecations to have a private log level API#11419
mixonic merged 1 commit intoemberjs:masterfrom
mixonic:raise-on-deprecation-no-dont-actually-raise

Conversation

@mixonic
Copy link
Member

@mixonic mixonic commented Jun 11, 2015

On the path to 1.13, we're adding a few deprecations that will take more than several days to completely remove from Ember's own tests. Therefor we've added a private API for changing the level of these deprecation messages to "silence". This both keeps the dev process smooth, and allows Travis to process our builds without blowing the log buffer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: few small typos in test name

@bantic
Copy link
Member

bantic commented Jun 11, 2015

LGTM. My only thought is maybe introduce only one new underscored prop on the Ember global (i.e. change _addDeprecationLevel and _deprecationLevels to _deprecations.addLevel and _deprecations.levels). I would be hesitant to put too many new properties on the Ember global, but it's less concerning since they are underscored.

@mixonic mixonic force-pushed the raise-on-deprecation-no-dont-actually-raise branch from ab24816 to 9699cf7 Compare June 11, 2015 20:49
@mixonic
Copy link
Member Author

mixonic commented Jun 11, 2015

These methods should move to Ember.Debug

@mixonic mixonic force-pushed the raise-on-deprecation-no-dont-actually-raise branch from 9699cf7 to 7f38ad4 Compare June 11, 2015 21:09
@mixonic mixonic force-pushed the raise-on-deprecation-no-dont-actually-raise branch from 7f38ad4 to f56a8c5 Compare June 11, 2015 21:28
mixonic added a commit that referenced this pull request Jun 11, 2015
…ctually-raise

[BUGFIX beta] Refactor deprecations to have a private log level API
@mixonic mixonic merged commit 7498bae into emberjs:master Jun 11, 2015
@mixonic mixonic deleted the raise-on-deprecation-no-dont-actually-raise branch June 11, 2015 22:21
bantic added a commit to bantic/ember.js that referenced this pull request Jun 12, 2015
Fixes an issue introduced by emberjs#11419 where the evaluation of
`ENV.RAISE_ON_DEPRECATION` was moved to boot-time rather than run-time.

Previously, it was possible to set `RAISE_ON_DEPRECATION` to true midway
through running an app, and all deprecations after that would throw
because `Ember.deprecate` would check the value of the env variable
every time it was called.

The code in emberjs#11419 changed to a [one-time evaulation at boot-time](https://github.com/emberjs/ember.js/blob/master/packages/ember-debug/lib/main.js#L279-L281),
breaking that original behavior. This commit restores the old behavior
while still allowing changing deprecation behavior for specific
deprecations by id.
rwjblue pushed a commit that referenced this pull request Jun 13, 2015
Fixes an issue introduced by #11419 where the evaluation of
`ENV.RAISE_ON_DEPRECATION` was moved to boot-time rather than run-time.

Previously, it was possible to set `RAISE_ON_DEPRECATION` to true midway
through running an app, and all deprecations after that would throw
because `Ember.deprecate` would check the value of the env variable
every time it was called.

The code in #11419 changed to a [one-time evaulation at boot-time](https://github.com/emberjs/ember.js/blob/master/packages/ember-debug/lib/main.js#L279-L281),
breaking that original behavior. This commit restores the old behavior
while still allowing changing deprecation behavior for specific
deprecations by id.

(cherry picked from commit 7290c71)
@pangratz
Copy link
Member

Hmm, somehow it would be nice if this would be available in ember-data as well. Currently there are massive deprecation warnings due to store#pushMany being deprecated in favor of store#push. Do you think there is a way to enable different deprecation levels in ember-data as well? As far as I can see Ember.Debug is only available within Ember, right?

@rwjblue
Copy link
Member

rwjblue commented Jun 14, 2015

Sure, it should be available to ember-data.

@pangratz
Copy link
Member

Yeah, I just figured this is as fresh as it gets and available since v2.0.0-beta.1. Sorry for the noise ...

@mixonic
Copy link
Member Author

mixonic commented Jun 14, 2015

@pangratz in 1.13 as well 👏 something like this should probably go through the RFC process and become a public API- It seems bad to opt into a new private-but-already-used-by-ember-data use.

@pangratz
Copy link
Member

Okidok, maybe I can come up with such in the next days...

@rwjblue
Copy link
Member

rwjblue commented Jun 14, 2015

Agreed. I believe that @teddyzeenney will also be excited about using this from the inspector (to get raise on deprecation for specific deprecations for easier tracking down of deprecations).

We also need to begin adding ids for all usages of Ember.deprecate though...

@pangratz
Copy link
Member

Okay, I gave it a shot: emberjs/rfcs#65

@pangratz
Copy link
Member

We also need to begin adding ids for all usages of Ember.deprecate though...

@rwjblue can you elaborate? The default behavior still exists, only a finer grained control over specific deprecation warning is added, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants