Logs debug errors to the console. This function is the same as console.error
.
Logs debug errors to the console. This function is the same as console.error
.
error: function() {
if (process.env.LOG_LEVEL >= levels.ERROR) {
_error.apply(null, arguments);
}
},
Logs debug info to the console. This function is the same as console.info
.
info: function() {
if (process.env.LOG_LEVEL >= levels.INFO) {
_info.apply(null, arguments);
}
},
Logs debug messages to the console. This function is the same as console.log
.
log: function() {
if (process.env.LOG_LEVEL >= levels.ALL) {
_log.apply(null, arguments);
}
},
Prints all messages that are retrieved from the splunkd server to the console.
printMessages: function(allMessages) {
allMessages = allMessages || [];
for(var i = 0; i < allMessages.length; i++) {
var message = allMessages[i];
var type = message["type"];
var text = message["text"];
var msg = '[SPLUNKD] ' + text;
switch (type) {
case 'HTTP':
case 'FATAL':
case 'ERROR':
this.error(msg);
break;
case 'WARN':
this.warn(msg);
break;
case 'INFO':
this.info(msg);
break;
case 'HTTP':
this.error(msg);
break;
default:
this.info(msg);
break;
}
}
},
Sets the global logging level to indicate which information to log.
Name | Type | Description |
---|---|---|
level | String,Number | A string or number ("ALL" = 4 | "INFO" = 3 | "WARN" = 2 | "ERROR" = 1 | "NONE" = 0) indicating the logging level. |
splunkjs.Logger.setLevel("WARN");
splunkjs.Logger.setLevel(0); // equivalent to NONE
setLevel: function(level) { setLevel.apply(this, arguments); },
Logs debug warnings to the console. This function is the same as console.warn
.
warn: function() {
if (process.env.LOG_LEVEL >= levels.WARN) {
_warn.apply(null, arguments);
}
},