1.0.6 • Published 1 year ago

gamma-draconis v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Gamma Draconis

npm version

Gamma Draconis is a simple logger library based on Single-Table Design and DynamoDb.

Installing

Using NPM:

npm install gamma-draconis --save

Or using Yarn:

yarn add gamma-draconis

Getting 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:

iddescription
MY-APPLICATION#INFO#2023-02-12T00:00:00.000ZYour data object kere
MY-APPLICATION#WARN#2023-02-12T00:00:00.000ZYour warning log object here
MY-APPLICATION#ERROR#2023-02-12T00:00:00.000ZYour error log object here

Made with 💙 by Gustavo Messagi