1.0.6 • Published 3 years ago
gamma-draconis v1.0.6
Gamma Draconis
Gamma Draconis is a simple logger library based on Single-Table Design and DynamoDb.
Installing
Using NPM:
npm install gamma-draconis --saveOr using Yarn:
yarn add gamma-draconisGetting Started
First of all you need to install the gamma draconis' dependency, go to Installing section and see how to install. After that, you should to create a table on dynamodb, you can follow the AWS Documentation to figure it out. The table's Partition Key needs to be named as id.
Once we have done this, we can create and instance of Logger and use logging functions, as in the below example.
Example
import Logger from 'gamma-draconis'
const logger = new Logger(
{
accessKeyId: 'AWS_ACCESS_KEY',
secretAccessKey: 'AWS_SECRET_ACCESS_KEY',
region: 'REGION',
dynamodb: 'DYNAMODB_TABLE_NAME'
},
'my-application'
)
logger.info({ description: 'Your data object here' })
// But you can use logger.warn and logger.error aswell
logger.warn({ description: 'Your warning log object here' })
logger.error({ description: 'Your error log object here' })The output from example will be something like:
| id | description |
|---|---|
| MY-APPLICATION#INFO#2023-02-12T00:00:00.000Z | Your data object kere |
| MY-APPLICATION#WARN#2023-02-12T00:00:00.000Z | Your warning log object here |
| MY-APPLICATION#ERROR#2023-02-12T00:00:00.000Z | Your error log object here |
Made with 💙 by Gustavo Messagi