Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.21 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.21 KB

log

Build Status Coverage Status

A package for creating logs in S3

Installation

npm install @janiscommerce/log

API

  • add(log, bucketName)
    Parameters: log [Object], bucketName [String]
    Puts the recieved log into the specified S3 bucket.

Errors

The errors are informed with a LogError.
This object has a code that can be useful for a correct error handling.
The codes are the following:

Code Description
1 Invalid log
2 Invalid bucket
3 S3 Error

Usage

const Log = require('@janiscommerce/log');

Log.add({
	type: 1,
	entity: 'api',
	entity_id: 'product',
	message: '[GET] Request from 0.0.0.0 of custom_data'
	// ...
}, 'my-bucket');

Notes

In order to connect into S3, this package requires the aws volume in the docker-compose.yml.

volumes:
  ~/.aws:/root/.aws