README
log4js2 AJAX appender
This module provide an AJAX appender for log4js2 module.
Getting started
Prerequisites
You will need the following things properly installed on your computer :
Installation
This module required log4js2 and axios on your project to work. Install it and these dependencies like so :
$ npm add log4js2 axios @norauto/log4js2-ajax-appender
Usage
Create a javascript file to provide some log strategy.
import * as log4js from 'log4js2'
import { AjaxAppenderProvider } from 'log4js2-ajax-appender'
log4js.addAppender(AjaxAppenderProvider({
method: 'POST',
url: '/logs',
headers: {
'Content-Type': 'text/plain'
}
}))
log4js.configure({
layout: '%d{ISO8601} [%level] %logger - %message',
appenders: [ 'ajaxAppender' ],
loggers: [{
logLevel: log4js.LogLevel.WARN
}]
})
export log4js
Here you can use the log4js
to send log through AJAX requests to your log endpoint.
Development
In order to contribute and be able to start developing on the project, you will have to follow following steps :
$ git clone <repository>
$ cd <repository>
$ npm install
Running tests
npm run test
Building
npm run build