Skip to content

Commit

Permalink
Fixed CWDebug.err producing an error
Browse files Browse the repository at this point in the history
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
Mario Schreiner committed Jul 5, 2015
1 parent 474e4d8 commit 648dff9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ConnichiwaResources/weblib_source/common/CWDebug.js
Expand Up @@ -101,6 +101,8 @@ CWDebug._getDebugInfo = function() {
* @function * @function
*/ */
CWDebug.log = function(level, msg) { CWDebug.log = function(level, msg) {
if (console === undefined) return;

if (this._debug && level <= this._logLevel) { if (this._debug && level <= this._logLevel) {
console.log(level + '|' + msg); console.log(level + '|' + msg);
} }
Expand All @@ -113,8 +115,12 @@ CWDebug.log = function(level, msg) {
* @function * @function
*/ */
CWDebug.err = function(msg) { CWDebug.err = function(msg) {
if (console === undefined) return;

if (this._debug) { if (this._debug) {
console.err(msg); if (console.err) console.err(msg);
else if (console.error) console.error(msg);
else console.log("ERROR: "+msg);
} }
}; };


Expand Down

0 comments on commit 648dff9

Please sign in to comment.