Skip to content

Commit

Permalink
Test if the supplied log level is defined in node-syslog.
Browse files Browse the repository at this point in the history
Remove eval()! :)
  • Loading branch information
till committed Jul 16, 2012
1 parent 73b8013 commit 0638da7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion exampleConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Optional Variables:
log: log settings [object, default: undefined]
backend: where to log: stdout or syslog [string, default: stdout]
application: name of the application for syslog [string, default: statsd]
level: log level for syslog [string, default: LOG_INFO]
level: log level for [node-]syslog [string, default: LOG_INFO]
*/
{
Expand Down
5 changes: 4 additions & 1 deletion lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ Logger.prototype = {
} else {
if (!type) {
type = this.level
if (!this.util[type]) {
throw "Undefined log level: " + type;
}
} else if (type == 'debug') {
type = "LOG_DEBUG";
}
this.util.log(eval("this.util." + this.level), msg);
this.util.log(this.util[type], msg);
}
}
}
Expand Down

0 comments on commit 0638da7

Please sign in to comment.