-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Log] Provide a default log category for Y.log calls
Set a default log category of info if no category was specified, or the category specified is not in the list of valid categories.
- Loading branch information
1 parent
3d336a7
commit dacc8fe
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,12 @@ INSTANCE.log = function(msg, cat, src, silent) { | |
bail = excl[src]; | ||
} | ||
|
||
// Set a default category of info if the category was not defined or was not | ||
// a real category. | ||
if ((typeof cat === 'undefined') || !(cat in LEVELS)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
triptych
Contributor
|
||
cat = 'info'; | ||
} | ||
|
||
// Determine the current minlevel as defined in configuration | ||
Y.config.logLevel = Y.config.logLevel || 'debug'; | ||
minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@andrewnicols This line breaks log messages from YUI Test.
Prior to this commit, Y.log() allowed arbitrary log levels, which was useful in places like YUI Test where we want to log messages with level 'pass' to indicate passing tests, 'fail' to indicate failing tests, etc. It's also useful in developer-land for logging and filtering based on custom criteria.
As of this commit, test results from YUI Test are all logged as 'info', which means test failures are not properly reported in the browser test console, grover, or yeti. What was the reason for restricting log categories to a hard-coded set of categories?