Permalink
Browse files

Fixed CWDebug.err producing an error

On newer versions of Safari, console.err() is not available. CWDebug.err now uses CWDebug.error() instead and falls back to console.log() if that is not available as well
  • Loading branch information...
BlackWolf committed Jul 5, 2015
1 parent 474e4d8 commit 648dff9dc748ade0d8aca3ea63ed7cecce5ddbe7
Showing with 7 additions and 1 deletion.
  1. +7 −1 ConnichiwaResources/weblib_source/common/CWDebug.js
@@ -101,6 +101,8 @@ CWDebug._getDebugInfo = function() {
* @function
*/
CWDebug.log = function(level, msg) {
if (console === undefined) return;
if (this._debug && level <= this._logLevel) {
console.log(level + '|' + msg);
}
@@ -113,8 +115,12 @@ CWDebug.log = function(level, msg) {
* @function
*/
CWDebug.err = function(msg) {
if (console === undefined) return;
if (this._debug) {
console.err(msg);
if (console.err) console.err(msg);
else if (console.error) console.error(msg);
else console.log("ERROR: "+msg);
}
};

0 comments on commit 648dff9

Please sign in to comment.