mumba-microservice-logger

A Mumba Microservice module that provides basic logger (Bunyan) support.

Usage no npm install needed!

<script type="module">
  import mumbaMicroserviceLogger from 'https://cdn.skypack.dev/mumba-microservice-logger';
</script>

README

Mumba Logger Microservice Module

Provide logger support for a Microservice using Bunyan.

DI Container

Adds a Bunyan object as "logger".

Requires that a Config object has been registered as config.

When the logger resolves, it expects that the Bunyan configuration is set in the logger path in the Config object.

Installation

$ npm install --save mumba-microservice-logger
$ typings install -—save dicontainer=npm:mumba-typedef-dicontainer

Examples

const Sandal = require("sandal");
import {DiContainer} from "mumba-typedef-dicontainer";
import {Config} from "mumba-config";
import {MicroserviceLoggerModule} from "mumba-microservice-logger";

let container: DiContainer = new Sandal();

// Set the configuration for the logger.
// (or include the Microservice Config Module and set `defaultConfig`)
container.object('config', new Config({
    logger: {
        name: 'the-name-of-the-logger'
        // Add more configuration here.
    }
}));

// Register the module.
MicroserviceLoggerModule.register(container);

container.resolve('logger', (err: Error, logger: any) => {
    if (err) {
        throw err;
    }

    logger.info('It works!');
});

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of Mumba Config Microservice Logger is Andrew Eddie.

List of all contributors

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.