logger-genesis
v6.0.0
Published
Logger package for genesis developers
Downloads
56
Readme
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.)