Skip to content

Commit

Permalink
For module loggers, use info method for debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
jwolski committed Nov 26, 2015
1 parent 61cd510 commit 1492cc2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/logging/module_logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ function ModuleLogger(ringpop, configName) {
}

ModuleLogger.prototype.debug = function debug(msg, meta) {
this._log('debug', msg, meta);
// Logging at info level for "debug" logs is intentional.
// The level is controlled by config, not the logger itself.
this._log('debug', msg, meta, 'info');
};

ModuleLogger.prototype.info = function info(msg, meta) {
Expand Down Expand Up @@ -56,7 +58,8 @@ ModuleLogger.prototype.canLogAt = function canLogAt(desiredLevel) {
return configLevel !== Levels.off && configInt <= desiredInt;
};

ModuleLogger.prototype._log = function _log(msgLevel, msg, meta) {
ModuleLogger.prototype._log = function _log(msgLevel, msg, meta, loggerMethod) {
loggerMethod = loggerMethod || msgLevel;
var configLevel = this.ringpop.config.get(this.configName);
var configInt = Levels.convertStrToInt(configLevel);
var msgInt = Levels.convertStrToInt(msgLevel);
Expand All @@ -66,7 +69,7 @@ ModuleLogger.prototype._log = function _log(msgLevel, msg, meta) {
!isNaN(msgInt) &&
msgInt >= configInt &&
msgInt < this.offInt) {
this.ringpop.logger[msgLevel](msg, meta);
this.ringpop.logger[loggerMethod](msg, meta);
}
};

Expand Down

0 comments on commit 1492cc2

Please sign in to comment.