1.0.2 • Published 4 years ago

log4js-rest-log v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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 server
  • appName - string - the channel to send log messages
  • env - object : { host: os.networkInterfaces(), type: os.hostname() } (optional) - envirioment of application
  • content - 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.

1.0.2

4 years ago

1.0.1

4 years ago