-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differential loglevel #1678
base: dev-3.x
Are you sure you want to change the base?
Differential loglevel #1678
Conversation
This commit adds differential logging support such that different log sources can have independent logLevels specified. This allows warnings to be shown from noisy modules, whilst getting debugging from the item you are actively developing.
Passes browser tests on:
|
Seeing these failures when I run yeti with phantom - will have to look into it more later as I'm leaving now. If anyone has any ideas why only phantom on node 0.10 is failing, I'm all ears! |
Ok, here is what I think: I will like to reduce the complexity of |
What did you have in mind @caridy? |
Simply to remove all the |
To me, the notion of removing Y.log seems like you're cutting off your nose to spite your face. I really don't think that Gallery modules are the way forward here (for many reasons which I can detail if you wish), and moving everything to a custom module would be tricksy with regards deprecation and backwards compatibility. Additionally, if it were a custom module presumably the calls would not be removed by Shifter without a customised Shifter configuration for every build out there. Writing a custom module which could supplement, or override Y.log is a possibility, but to me this really should be core functionality. |
clarifying:
|
Can I ask where these changes have been discussed? I've not seen anything in IRC, and although I don't watch every round table, I can't recall it being mentioned, and nor is it discussed in the blog. If this is the case, we can go down the route of overwriting Y.log (or doing some form of AOP), but is there a sensible way of doing this with current Loader configuration? I'm not aware of anything which would do this reliably at present, but there are many parts of the loader which are under-documented. |
Okay, so by using Y.config.core, you can replace the list of modules to either replace yui-log, or add a module directly after it. This module already has to have already been included as the loader won't include it for you. |
@andrewnicols that's part of the work we have to do. @ekashida is working on the proper hooks that will allow you to patch things in YUI before any module gets evaluated, etc. Discussion about this topics are coming very soon! |
Thanks @caridy, I've managed to implement this in the mean time using Y.config.core and including a new logging module immediately after the standard yui-log. Only a PoC within Moodle but it does demonstrate the potential for such a solution. Still don't entirely agree that we should remove logging entirely, but I can see the benefit of doing it this way for those with very obscure requirements, but I do disagree that this issue fits into that category. Cheers, Andrew |
Yes, it is definitely doable. This is the code that I will like to see going away: Reducing it to something like (plus a short-circuit to exit when logs are not needed): And anything else, should be just an external module, maybe from bower, who knows! The main situation is that |
Did you mean to post the same URL there twice? ;) I assume it's mean to be L73-L85? Please don't force people to use Bower - as I mentioned in my Roundtable talk last week, our build processes are very different to yours and our usage of YUI different also. Relying on this kind of process will force people in a particular direction which may not be suitable to their project at all. |
good catch! yes, L73 to L85 (sort of). we are not going to force people to use a particular tool. In fact I think that most people will use the default implementation, and will create their custom implementation for filters. this is the case of mojito for example, where there is a custom Y.log to deal with server and client, which also implements its own logLevels, etc. |
This commit adds differential logging support such that different log
sources can have independent logLevels specified. This allows warnings to
be shown from noisy modules, whilst getting debugging from the item you are
actively developing.
I've also taken the liberty of splitting out the log tests from the rest of the tests after I got fed up of waiting for other tests to run.
I've also, also tidied up the console overrides to reduce code duplication, and to make sure that we actually reset the console afterwards.
Here's a sample YUI_config to demonstrate how this can work:
Technically speaking, the
*
key on logExclude is not required, but I have included it for completeness.As a note, this could be easily extended to support regular expressions, but I feel that this would probably be adding too much of an overhead at this stage