Skip to content

Commit

Permalink
Merge pull request #1612 from adaptlearning/feature/#1444
Browse files Browse the repository at this point in the history
amends logging module to use matching methods of the console object
  • Loading branch information
moloko authored Jul 24, 2017
2 parents e018fc5 + 933e007 commit d383e75
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/js/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define([
_config: {
_isEnabled: true,
_level: LOG_LEVEL.INFO.asLowerCase, // Default log level
_console: true, // Log to console
_console: true // Log to console
},

initialize: function() {
Expand Down Expand Up @@ -97,8 +97,12 @@ define([
var log = [level.asUpperCase + ':'];
data && log.push.apply(log, data);

console.log.apply(console, log);

// is there a matching console method we can use e.g. console.error()?
if(console[level.asLowerCase]) {
console[level.asLowerCase].apply(console, log);
} else {
console.log.apply(console, log);
}
}

});
Expand Down

0 comments on commit d383e75

Please sign in to comment.