0.0.1 • Published 5 years ago

nats-logger v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

NATS Logger

A central logging service based on NATS infrastructure

Author

onichandame

Usage

Installation:

yarn add nats-logger

For client:

import { Logger } from 'nats-logger'

const logger = new Logger({
  reporter: 'MyService',
  subject: 'natsloggerv0',
  servers: [ "nats://localhost:4222" ]
})

logger.debug('Jack visited', { topic: 'Er' })
logger.info('mom visited', { topic: 'gotta pay attention' })
logger.warn('headmaster visited', { topic: 'something must be wrong' })
logger.error('Hitler visited', { topic: 'CALL THE POLICE!' })

For server:

import { LogServer } from 'nats-logger'

const server = new LogServer()

server.listen({
  nats: {
    servers: ["nats://localhost:4222"]
  },
  mongo: {
    servers: ["mongo://localhost:27017"]
  }
})

Test

To test this library there must be genuine NATS server and MongoDB instance available. To utilize Github Actions as the automated CI tool, use this action to bootstrap a NATS cluster during tests. To test if the cluster is available, use this action. To start MongoDB instances for testing, use this action

run yarn && yarn test to start testing suite.

0.0.1

5 years ago

0.0.0

5 years ago