Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.
/ hato-logging-typed Public archive
forked from openrm/hato-logging

A plugin for logging messages passing through hato

License

Notifications You must be signed in to change notification settings

openrm/hato-logging-typed

 
 

Repository files navigation

hato-logging

CircleCI Maintainability Test Coverage GitHub license

A plugin for logging messages passing through hato

About

This is a plugin for hato, an amqp framework.

This plugin facilitates logging of messages that are published and consumed by hato.

The plugin accepts a logging function to which messages will be passed as they are published and consumed. The passed logging function should accept one argument which will be passed in the following format:

{
    command, // Either 'publish' or 'consume'
    exchange,
    routingKey,
    content
}

Getting Started

Import the package

const Logging = require('hato-logging');

Instantiate the logging plugin with a logging function of your choice, if left empty the default is console.log

const MyPlugin = new Logging({
    log: (level, data, msg) => logger[level](data, msg), // example: bunyan
    body: {
        enabled: true,
        maxBytes: 10000
    }
});

Construct a new client including the logging plugin

const client = new Client(BROKER_URL, {
    plugins: [
        ...,
        MyPlugin
    ],
});

Running Tests

Make sure you have a message broker running. The tests expect RabbitMQ.

$ docker run -it --name rabbitmq -p 5672:5672 rabbitmq:3.6-alpine

Then run

$ make test
$ make lint

License

MIT

About

A plugin for logging messages passing through hato

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.9%
  • Makefile 4.1%