Convert Y.log to Y.message for deprecations #1560

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
Contributor

andrewnicols commented Jan 16, 2014

When we recently upgraded to 3.13, we had a couple of people experiencing issues in code which was still using Y.get instead of Y.one, as Y.get was recently removed (these were predominantly gallery modules).

These deprecations hadn't been picked up earlier because when developing, we typically run with a config such that:

  • the group representing our modules has a filter setting of 'debug'
  • core YUI has a filter setting of 'raw'

This means that we can debug our modules complete with all debugging messages, and can still trace through core YUI code where required, without being inundated with messages from core YUI which are less relevant to us. I suspect that we are not alone in this way of developing with YUI.

Proposed solutions

I can see two reasonable ways forward which would help developers pick up deprecation notices whilst still seeing the wood through the trees and not have all core YUI debug messages. These possible solutions are discussed below.

Change all deprecation warnings from Y.log to Y.message

Shifter has a regex which is designed to remove Y.log, but not Y.message.
For most people, changing to use this will be sufficient for this purpose and will mean that deprecation notices are more readily visible.
For production use, setting Y.config.debug to false will remove these too. See http://yuilibrary.com/yui/docs/api/classes/config.html#property_debug for documentation on this property.

Introduce a new Y.deprecated and us this instead of Y.log

This would also not be removed by Shifter and would operate almost identically to the Y.message solution. The difference being that it would be possible to introduce a new property in Y.config, similar to the debug property, but specifically aimed at deprecation warnings. This would allow them to be separated out from standard messages.

Having given it some thought, I suspect that using Y.message would be sufficient for a majority of cases and I can't really think of any reason you'd want one, but not the other.

Convert Y.log to Y.message for deprecations
This has the result that deprecation warnings are not stripped by Shifter
by default such that it is possible to run the raw or minified versions of
the core YUI library when developing non-core code and still see
deprecation warnings.

For production usage, Y.config.debug should be set to false to ensure that
all messages are removed from output.
Owner

caridy commented Jan 16, 2014

@andrewnicols this solution is not going to solve the real issue, this solution just add more complexity, and it happens to be non-backward compatible.

really, the problem here is education, there are plenty of configurations in yui to control what you see while in development, without having to sacrifice the production code or the performance penalties for unnecessary log fn calls.

deprecated messages should be warnings, if the reason why people are completely disabling the logs is because they are too many to keep up with, they should use the proper settings for debugging, e.g.:

YUI({
    logLevel: 'warn',
    filter: 'debug'
})

with that setting, you should get warning and error messages in the log, ideal for development, while on production, u just need to get the filter to 'min', and logLevel will be ignored automatically. what could be more simple than that?

in fact, I think we should set logLevel to "warn" by default, so you don't get all messages unless you want it too, that might be better because it is BC.

Contributor

andrewnicols commented Jan 16, 2014

Hi Caridy,

Good thinking - I really should have thought of that given I wrote the logLevel stuff ;)

@andrewnicols andrewnicols reopened this Jan 16, 2014

Owner

caridy commented Jan 16, 2014

@andrewnicols do you want to get the ball rolling on the logLevel: 'warn'?

Contributor

andrewnicols commented Jan 16, 2014

Actually, scrap that. This won't work.

Y.config.logLevel is a global setting and applies to all Y.log calls, not just those from a particular group (as in these kind - http://yuilibrary.com/yui/docs/api/classes/config.html#property_groups).

If you set Y.config.logLevel to warn, then you will lose all 'debug' messages for all groups. There is no way of applying logLevel at a per-group level because Y.log does not know which module it is servicing, merely the instance and that instance will contain a mixture of local and core modules.

Contributor

andrewnicols commented Jan 21, 2014

Hi @caridy,

I'd really appreciate your thoughts on this following my latest comment.

Cheers,

Andrew

Owner

caridy commented Jan 21, 2014

@andrewnicols you never mention that you want to filter by groups :)

sounds off to me, can you explain a little bit more what you really want?

what I proposed is to adjust the log level (yes, it is global) to avoid the massive amount of logs while still getting important notifications about deprecations and so, where this will help people to not have to shutdown the logs completely while on development, which is a problem for us to warn on deprecations, and that should work just fine.

Contributor

andrewnicols commented Jan 21, 2014

I did, I did! ;)

What I want

To have deprecation notices present in code, regardless of whether a debug, raw, or minified version is used, but have the ability to control when it is shown.

Why I want this (plus more detail and rationale)

For us, and I suspect others too, when we are developing our own modules, we have the filter level set to 'DEBUG' for our group only so that we get the -debug versions of our modules.
We don't generally require the debug versions of core code, and have that set to use the 'raw' filter. This means we can choose to step back using a debugger if required for the odd bit, but without being inundated with debug messages from core. We want the debug level versions of our code, but not core code.

This has caused issues when we're using code which uses deprecated core functions. In a couple of cases, people were using Y.get in gallery modules we were using. We only discovered this when we updated to the latest version of YUI and things suddenly broke. We hadn't seen all of the deprecation notices because of the above filter settings.

Speaking to others on IRC, it seems that we are not alone in this way of using filters and groups.

In my opinion, deprecation notices should not be removed by Shifter at all, ever. They should be present in minified, raw, and debug code but it should still be possible to chose when to silence them using configuration.

Possible solutions

As mentioned before, I can see two ways of doing this:

  • use Y.message() instead of Y.log() for deprecation notices, and encourage use of the Y.config.debug property to silence all messages; or
  • use a new Y.deprecated() function instead of Y.log(), and introduce a new Y.config.showDeprecationWarnings property to control deprecation messages independently to other messages.

The former option is relatively trivial and is the contents of this pull request at present.
I have worked up a quick prototype for the latter option but haven't yet written unit tests for it or fully tested it.

Does this make sense?

Owner

caridy commented Jan 23, 2014

just to clarify few things:

  • the reason why we remove Y.log is performance
  • you want to introduce a new statement that is not removed by shifter but still you want to silence it (in production?). That sounds like Y.log() with a performance penalty.
  • your ultimate goal is to be able to detect deprecations during development, and only during development, Y.log, logLevel and filter will achieve that today.

about the initial proposal:

we CANNOT have logLevel to be granular per group because individual Y.log statements will not provide enough information about the origin of the call, only the source value which is completely arbitrary and optional.

about the last proposal:

  • Lets pretend that I'm ok with Y.deprecated(), we will have to have it silenced by default (for backward compatibility), which means that people will have to enable it in their app thru a setting. And, depending on the amount of Y.deprecated() calls, and the recurrence of those calls, there is a perf degradation that will happen. Imagine an app that was using Y.get() a lot, with the default settings (silenced deprecation msgs), the cost of calling the Y.deprecated() on every call to Y.get() would have be considerable.
  • Also, I don't see the difference between Y.log() and Y.message().

In general, this is not a trivial problem.

Contributor

andrewnicols commented Jan 24, 2014

Hi Caridy,

I understand your points, but I'm afraid that I disagree with the third.
Yes, you can use Y.log with logLevel and filter to display all log messages, but that creates a case of not seeing the wood for the trees.

I also understand that we cannot have logLevel set granularly on a group level (as I say, I wrote the logLevel functionality). It is also possible to use logExclude to remove certain sources (and logInclude to do the reverse), but you will still miss deprecation notices unless you know that you're looking for deprecations in a certain log source.

The following jsbin example is an attempt to demonstrate the issue that we face. This is just a very basic drag/drop example copied straight from the
examples page: http://jsbin.com/OsejUFIG/1/watch?js,output
If you view the browser's console (not the JSBin one), you'll see the following just at load time:

node: adding: removeChild yui-min.js:13
node: adding: hasChildNodes yui-min.js:13
node: adding: cloneNode yui-min.js:13
node: adding: hasAttribute yui-min.js:13
node: adding: scrollIntoView yui-min.js:13
node: adding: getElementsByTagName yui-min.js:13
node: adding: focus yui-min.js:13
node: adding: blur yui-min.js:13
node: adding: submit yui-min.js:13
node: adding: reset yui-min.js:13
node: adding: select yui-min.js:13
node: adding: createCaption yui-min.js:13
base: constructor called yui-min.js:13
base: init called yui-min.js:13
attribute: Adding attribute: initialized yui-min.js:13
attribute: Adding attribute: destroyed yui-min.js:13
attribute: Adding attribute: dragCursor yui-min.js:13
attribute: Adding attribute: clickPixelThresh yui-min.js:13
attribute: Adding attribute: clickTimeThresh yui-min.js:13
attribute: Adding attribute: throttleTime yui-min.js:13
attribute: Adding attribute: dragMode yui-min.js:13
attribute: Adding attribute: initialized yui-min.js:13
attribute: Adding attribute: clickPixelThresh yui-min.js:13
attribute: Adding attribute: clickTimeThresh yui-min.js:13
base: constructor called yui-min.js:13
base: init called yui-min.js:13
event: yui_3_14_1_1_1390527414925_12: Firing delegate:init yui-min.js:13
attribute: Adding attribute: initialized yui-min.js:13
attribute: Adding attribute: destroyed yui-min.js:13
attribute: Adding attribute: container yui-min.js:13
attribute: Adding attribute: nodes yui-min.js:13
attribute: Adding attribute: invalid yui-min.js:13
attribute: Adding attribute: lastNode yui-min.js:13
attribute: Adding attribute: currentNode yui-min.js:13
attribute: Adding attribute: dragNode yui-min.js:13
attribute: Adding attribute: over yui-min.js:13
attribute: Adding attribute: target yui-min.js:13
attribute: Adding attribute: dragConfig yui-min.js:13
attribute: Adding attribute: handles yui-min.js:13
attribute: Adding attribute: dragConfig yui-min.js:13
attribute: Adding attribute: container yui-min.js:13
attribute: Adding attribute: handles yui-min.js:13
base: constructor called yui-min.js:13
base: init called yui-min.js:13
event: yui_3_14_1_1_1390527414925_15: Firing drag:init yui-min.js:13
attribute: Adding attribute: initialized yui-min.js:13
attribute: Adding attribute: destroyed yui-min.js:13
attribute: Adding attribute: node yui-min.js:13
attribute: Attribute: node, raw value: DIV yui_3_14_1_1_1390527414925_13 modified by setter to:DIV yui_3_14_1_1_1390527414925_13 yui-min.js:13
attribute: Adding attribute: dragNode yui-min.js:13
attribute: Adding attribute: offsetNode yui-min.js:13
attribute: Adding attribute: startCentered yui-min.js:13
attribute: Adding attribute: clickPixelThresh yui-min.js:13
attribute: Adding attribute: clickTimeThresh yui-min.js:13
attribute: Adding attribute: lock yui-min.js:13
attribute: Attribute: lock, raw value: false modified by setter to:false yui-min.js:13
attribute: Adding attribute: data yui-min.js:13
attribute: Adding attribute: move yui-min.js:13
attribute: Adding attribute: useShim yui-min.js:13
attribute: Adding attribute: activeHandle yui-min.js:13
attribute: Adding attribute: primaryButtonOnly yui-min.js:13
attribute: Adding attribute: dragging yui-min.js:13
attribute: Adding attribute: parent yui-min.js:13
attribute: Adding attribute: target yui-min.js:13
attribute: Attribute: target, raw value: false modified by setter to:false yui-min.js:13
attribute: Adding attribute: dragMode yui-min.js:13
attribute: Adding attribute: dragMode yui-min.js:13
attribute: Attribute: dragMode, raw value: point modified by setter to:point yui-min.js:13
attribute: Attribute: dragMode, raw value: null modified by setter to:0 yui-min.js:13
attribute: Adding attribute: groups yui-min.js:13
attribute: Attribute: groups, raw value: default modified by setter to:default yui-min.js:13
attribute: Adding attribute: handles yui-min.js:13
attribute: Attribute: handles, raw value: null modified by setter to:null yui-min.js:13
attribute: Adding attribute: bubbles yui-min.js:13
attribute: Adding attribute: haltDown yui-min.js:13
event: yui_3_14_1_1_1390527414925_32: Firing drag:dragNodeChange yui-min.js:13
attribute: Attribute: dragNode, raw value: DIV#yui_3_14_1_1_1390527414925_13 yui_3_14_1_1_1390527414925_13 modified by setter to:DIV#yui_3_14_1_1_1390527414925_13 yui_3_14_1_1_1390527414925_13 yui-min.js:13
event: yui_3_14_1_1_1390527414925_35: Firing drag:groupsChange yui-min.js:13
attribute: Attribute: groups, raw value: default modified by setter to:default yui-min.js:13
event: yui_3_14_1_1_1390527414925_33: Firing drag:initializedChange yui-min.js:13
event: yui_3_14_1_1_1390527414925_33: drag:initializedChange->sub: yui_3_14_1_1_1390527414925_34 yui-min.js:13
Selector: query: body returning: 1 yui-min.js:13
attribute: Adding attribute: throttleTime yui-min.js:13
attribute: Adding attribute: nodes yui-min.js:13
Selector: query: #demo returning: 1 yui-min.js:13
event: Using adaptor for mouseenter, #demo yui-min.js:13
Selector: query: #demo returning: 1 yui-min.js:13
event: Using adaptor for mouseleave, #demo yui-min.js:13
Selector: query: #demo returning: 1 yui-min.js:13
attribute: Adding attribute: initialized yui-min.js:13
event: yui_3_14_1_1_1390527414925_72: Firing delegate:initializedChange yui-min.js:13
event: yui_3_14_1_1_1390527414925_6: fireOnce event: domready already fired yui-min.js:13
attribute: Adding attribute: destroyed yui-min.js:13
attribute: Adding attribute: target yui-min.js:13

Then moving the mouse over the drag handles:

event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13
event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13
event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13
event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13
event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13

And finally, dragging one of the handles around a little (literally a few seconds to move an item from the bottom of the list to the top):

event: yui_3_14_1_1_1390527414925_64: mouseenter->sub: yui_3_14_1_1_1390527414925_65 yui-min.js:13
Selector: query: li[id="yui_3_14_1_1_1390527414925_85"] returning: 1 yui-min.js:13
Selector: query: li[id="yui_3_14_1_1_1390527414925_86"] returning: 0 yui-min.js:13
Selector: query: li[id="demo"] returning: 0 yui-min.js:13
Selector: query: li[id="yui_3_14_1_1_1390527414925_85"] returning: 1 yui-min.js:13
attribute: Adding attribute: invalid yui-min.js:13
Selector: query: input[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  select[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  button[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  a[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  textarea[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
attribute: Adding attribute: currentNode yui-min.js:13
event: yui_3_14_1_1_1390527414925_87: Firing delegate:currentNodeChange yui-min.js:13
event: yui_3_14_1_1_1390527414925_88: Firing drag:nodeChange yui-min.js:13
attribute: Attribute: node, raw value: LI#yui_3_14_1_1_1390527414925_85 yui_3_14_1_1_1390527414925_84 modified by setter to:LI#yui_3_14_1_1_1390527414925_85 yui_3_14_1_1_1390527414925_84 yui-min.js:13
event: yui_3_14_1_1_1390527414925_32: Firing drag:dragNodeChange yui-min.js:13
event: yui_3_14_1_1_1390527414925_32: drag:dragNodeChange->sub: yui_3_14_1_1_1390527414925_58 yui-min.js:13
attribute: Adding attribute: dragNode yui-min.js:13
event: yui_3_14_1_1_1390527414925_89: Firing delegate:dragNodeChange yui-min.js:13
attribute: Attribute: dragNode, raw value: LI#yui_3_14_1_1_1390527414925_85 yui_3_14_1_1_1390527414925_84 modified by setter to:LI#yui_3_14_1_1_1390527414925_85 yui_3_14_1_1_1390527414925_84 yui-min.js:13
event: yui_3_14_1_1_1390527414925_17: Firing drag:mouseDown yui-min.js:13
Selector: query: textarea[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  textarea *[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query: input[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  input *[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query: a[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  a *[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query: button[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  button *[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query: select[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
Selector: query:  select *[id="yui_3_14_1_1_1390527414925_85"] returning: 0 yui-min.js:13
event: yui_3_14_1_1_1390527414925_96: Firing drag:activeHandleChange yui-min.js:13
drag: Halting MouseDown yui-min.js:13
event: yui_3_14_1_1_1390527414925_21: Firing drag:afterMouseDown yui-min.js:13
Selector: query: body returning: 1 yui-min.js:13
dom-screen: docHeight returning 259 yui-min.js:13
dom-screen: docWidth returning 1246 yui-min.js:13
event: yui_3_14_1_1_1390527414925_26: Firing drag:start yui-min.js:13
event: yui_3_14_1_1_1390527414925_97: Firing drag:draggingChange yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,217 yui-min.js:13
dom-screen: setXY setting position to 51,217 yui-min.js:13
event: yui_3_14_1_1_1390527414925_68: mouseleave->sub: yui_3_14_1_1_1390527414925_69 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,215 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,212 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,205 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,199 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,198 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,196 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,192 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,190 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,189 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,187 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,184 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,183 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,181 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,177 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,175 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,172 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,168 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,166 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,165 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,164 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,162 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,156 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,150 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,138 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,133 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,130 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,124 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,122 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,117 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,115 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,114 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 51,113 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,111 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,101 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,89 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,80 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,78 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,76 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 52,72 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 53,67 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 53,59 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,50 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,41 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,38 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,35 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,31 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,27 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,22 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,19 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,11 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,0 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,-6 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 54,-8 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 53,-11 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 57,22 yui-min.js:13
event: yui_3_14_1_1_1390527414925_18: Firing drag:align yui-min.js:13
event: yui_3_14_1_1_1390527414925_19: Firing drag:drag yui-min.js:13
dom-screen: setXY setting position to 76,95 yui-min.js:13

As you can see, there's quite a lot of output. How anyone could be expected to find a deprecated message amongst that, when they have the logLevel set to debug because they're trying to find other issues is beyond me; or even to find messages relating to their own code.

I suspect you'll now say that the logLevel should only be set to warn whilst generally developing, and using a combination of logInclude and logExclude when developing in a specific area, but this doesn't really help expose the deprecation warnings either.

I should point out that there are only 13 instances of Y.log being used to display deprecation warnings in core at present.

Also, the difference between Y.log and Y.message is that only Y.log is removed by Shiter - Y.message is not removed using the standard shifter configuration.

Going back to the performance issue, a Y.deprecated() function could be written in such a way that it would return immediately in the case that Y.config.showDeprecationWarnings is not true. Yes, you'd have to step into the Y.deprecated function, and then run a test, and then return, but I'd argue that the benefits outweight the very insignificant performance effect. I have tried benchmarking the effects of this, but the results vary wildly between tests.

Hope this helps explain the issue further - I agree, this is not a trivial problem,

Andrew

Contributor

andrewnicols commented Jan 31, 2014

Any thoughts on this @caridy ?

Owner

caridy commented Jan 31, 2014

@andrewnicols didn't get a chance yet, we are on the road this week visiting the mothership.

Contributor

andrewnicols commented Jan 31, 2014

Enjoy the mothership!

Cheers,

Andrew

On 31 January 2014 15:18, Caridy Patino notifications@github.com wrote:

@andrewnicols https://github.com/andrewnicols didn't get a chance yet,
we are on the road this week visiting the mothership.

Reply to this email directly or view it on GitHubhttps://github.com/yui/yui3/pull/1560#issuecomment-33766092
.

Owner

caridy commented Jan 31, 2014

@juandopazo can you share your thoughts about this?

Member

juandopazo commented Jan 31, 2014

I think one simple solution that doesn't need a new API would be for deprecation messages to bypass logLevel. This way we can develop in debug mode with logLevel: 'error', which is what we should be doing, and still get deprecation messages.

So basically, define a log level called deprecated and those messages get logged always, no matter which log level is set.

@andrewnicols does that make sense to you?

Owner

ericf commented Jan 31, 2014

@juandopazo I like this solution. I think it will also help remind us to remove things that are deprecated once they've been so for a long enough time.

Owner

caridy commented Jan 31, 2014

agreed

Contributor

andrewnicols commented Feb 1, 2014

Hi all,

Thanks for the replies. Adding a logLevel of 'deprecated' (or something akin) was one of my first thoughts too, but unfortunately it doesn't address the issue.

As I mentioned before, we developer with a YUI_config such that core code uses a filter of 'raw', and our modules have a filter of 'debug'. This means that the version of core code used has no Y.log messages as they're stripped out by Shifter - this would include those with a 'deprecated' level.

Since the logLevel setting in the config is global, and not restricted to a particular group, we cannot use logLevel in such a way to leave debug messages on for the code we are actually developing plus the deprecated code, whilst removing them from core code.

Admittedly, this setting would help when using the logInclude, logExclude, or logLevel settings generally though.

I did have one other thought on this matter which would address some of @caridy's concerns: Still add a deprecated message (or logLevel), modify Shifter to not remove those in the 'raw' version of the files, yet still remove them from the minified versions. Effectively, make Shifter perform two filter passes.

Thanks,

Andrew

Member

juandopazo commented Feb 1, 2014

I thought about that too but it took me down a different path to asking myself what value the raw version actually provides. I'm used to developing in raw too, but maybe we should consider not only stopping to do that ,but maybe even discontinue the raw version and default the debug version to only logging errors.

Contributor

triptych commented Apr 15, 2014

Is this still a work in progress or ready to be considered by reviewers? If it's a WIP please update the title (something like "[WIP]") please.

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