зеркало из https://github.com/microsoft/statsd.git
Default loglevel (for syslog) in config file.
This commit is contained in:
Родитель
9f4649dd98
Коммит
73b8013a1d
|
@ -40,8 +40,9 @@ Optional Variables:
|
|||
output [true or false, default: true]
|
||||
|
||||
log: log settings [object, default: undefined]
|
||||
backend: where to log: stdout or syslog [default: stdout]
|
||||
application: name of the application for syslog [default: statsd]
|
||||
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]
|
||||
|
||||
*/
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var Logger = function (config) {
|
||||
this.config = config;
|
||||
this.backend = this.config.backend || 'stdout'
|
||||
this.level = this.config.level || "LOG_INFO"
|
||||
if (this.backend == 'stdout') {
|
||||
this.util = require('util');
|
||||
} else {
|
||||
|
@ -22,11 +23,11 @@ Logger.prototype = {
|
|||
this.util.log(DEBUG + msg);
|
||||
} else {
|
||||
if (!type) {
|
||||
type = this.util.LOG_INFO;
|
||||
type = this.level
|
||||
} else if (type == 'debug') {
|
||||
type = this.util.LOG_DEBUG;
|
||||
type = "LOG_DEBUG";
|
||||
}
|
||||
this.util.log(this.util.LOG_INFO, msg);
|
||||
this.util.log(eval("this.util." + this.level), msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче