logger-genesis
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

Easy ways to use logs and send them to RabbitMQ using menashmq in your service for TypeScript

Examples

Initialize once

index.ts

import logger from 'logger-genesis';

logger.initialize('systemA', 'serviceA', true, {
    createMenashRabbitMQConnection: true,
    uri: 'amqp://localhost:5672',
    logQueueName: 'log-queue',
});

Usage

import logger from 'logger-genesis';

logger.info(title, message, JSON.stringify(extraFields));

Methods

  • initialize()

  • info()

  • warn()

  • error()

Params

initialize

  • system -> Name of the system

  • service -> Name of the service

  • logQueueName -> Name of the Log's Queue

  • createRabbitConnection -> True if need to create connection to rabbitMQ with menash

  • uri -> Connection URI of rabbitMQ (Needed only if createRabbitConnection is true)

  • retryOptions -> retryOption to connect to RabbitMQ (details in menashmq readme, needed only if createRabbitConnection is true)

logInfo/logWarn/logError

  • title -> Title of the log

  • message -> The message of the log

  • extraFields -> Extra fields that you want to add (Like id, runUID and etc.)

Package Sidebar

Install

npm i logger-genesis

Weekly Downloads

11

Version

6.0.0

License

ISC

Unpacked Size

50.7 kB

Total Files

21

Last publish

Collaborators

  • elikov
  • systemgenesis0