A package for creating logs in S3
npm install @janiscommerce/log
add(log, bucketName)
Parameters:log [Object]
,bucketName [String]
Puts the recieved log into the specified S3 bucket.
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 |
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');
In order to connect into S3, this package requires the aws volume in the docker-compose.yml
.
volumes:
~/.aws:/root/.aws