Skip to content

A simple logger library using DynamoDB and single-table design

Notifications You must be signed in to change notification settings

gus-messagi/gamma-draconis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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

About

A simple logger library using DynamoDB and single-table design

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published