simple-relic-logs
v1.0.1
Published
A simple package to send logs to New Relic
Downloads
4
Maintainers
Readme
simple-relic-logs
A simple package to send logs to new relic
Using the package
To use this package just import it as shown bellow
import LogService from 'simple-relic-locs';
To create a LogService object just pass your api key inside the constructor
const log = new LogService('your_api_key_here');
It is possible to change the api key value after the creation.
const log = new LogService('your_api_key_here');
log.setApiKey('your_new_api_key_here');
To get the api key value just use getApiKey method
const log = new LogService('your_api_key_here');
cosnt apiKey = log.getApiKey();
The log can be sent using the asynchronous sendLog method
const log = new LogService('your_api_key_here');
log.sendLog({app: 'teste-log', message: 'teste-log'});
The response in successful case is
return {status: 'succeeded'};
In case of failures the response is
return {status: 'failed'};
A log message only has one required param, and it is 'message', but it is recommended to use 'app' to infrom teh application name and 'trigger' to give information about who trigger lambdas, for example.
{
"message": "your_message_here"
}