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

0.1.0 • Public • Published

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.

Package Sidebar

Install

npm i mumba-microservice-logger

Weekly Downloads

0

Version

0.1.0

License

Apache-2.0

Last publish

Collaborators

  • arvin.domingo
  • dennis.barbamumba
  • mumba.cloud
  • carl-oehme-mumba
  • kennbaker