1.0.2 • Published 4 years ago
log4js-rest-log v1.0.2
Rest Appender for log4js-node
Sends log events to a REST api. This is an optional appender for use with log4js.
npm install @log4js-node/rest
Configuration
type
-@log4js-node/rest-log
url
-string
- your REST API url to serverappName
-string
- the channel to send log messagesenv
-object : { host: os.networkInterfaces(), type: os.hostname() }
(optional) - envirioment of applicationcontent
-object
(optional) - content
Example
import log4js = require("log4js");
var os = require("os");
const logger = log4js.getLogger();
log4js.configure({
appenders: {
console: { type: "console" },
rest: {
type: "@log4js-node/rest-log",
appName: "Test App",
url: "https://xxx.yyy.zzz/log-api/",
content: "",
env: { host: os.networkInterfaces(), type: os.hostname() }
}
},
categories: {
default: {
appenders: ["console", "rest"],
level: "DEBUG"
}
}
});
logger.error("some error message");
This configuration will send all messages to the url
address.