simple-relic-logs
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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"
}

Readme

Keywords

Package Sidebar

Install

npm i simple-relic-logs

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

7.63 kB

Total Files

12

Last publish

Collaborators

  • madeiramadeirabr