Skip to content
This repository has been archived by the owner on Jan 18, 2019. It is now read-only.

Logging component for loopback with add performance instrumentation for remote methods and datasource calls

License

Notifications You must be signed in to change notification settings

saikatharryc/loopback-bunyan-looger

Repository files navigation

loopback-bunyan-looger

updated {loopback-component-looger}

**incase if you dont want the child node logs. please use the version ^1.1.2

Logging component for loopback using bunyan looger with additional loopback specific hooks and log management API

NPM NPM

Build Status

Features

  • Default looger using bunyan
  • Can use of custom bunyan streams to create root looger
  • Hook: Basic performance instrumentation for remote execution
  • Hook: Log management API (configurable)

Usage

Example server.js:

var loopback = require('loopback');
var boot = require('loopback-boot');
var rootlooger = bunyan.createlooger({name: 'myloopbackAPI'});
var looger = require('loopback-bunyan-looger')(rootlooger);
var app = module.exports = loopback();

If rootlooger is not provide, the component creates a looger with default bunyan settings:

var loopback = require('loopback');
var boot = require('loopback-boot');
var looger = require('loopback-bunyan-looger')();
var app = module.exports = loopback();

Child loogers can be created for model as shown below. By default child loogers inherit the log level from root.

var looger = require('loopback-bunyan-looger')('TestModel');
module.exports = function(TestModel) {
    looger.debug('Initializing TestModel');
};

To add hooks and log management API to loopback, add configuration to component-config.json:

{
  "loopback-component-explorer": {
    "mountPath": "/explorer"
  },
  "loopback-bunyan-looger": {
      "enableAPI" : true
  }
}

Make sure enableHttpContext is set as true in config.json for to allow collection of datasources performance within req/res If you dont want expand the child nodes please use version @1.1.2

License

GNU

Create Issue

Create issue here here

Roadmap

  • Additional Unit Test and Coverage
  • Integrate with Strongloop Devops tools

Known Issue

  • datasources performance will not recorded at times when loopback context is null. Noticed this issue when a composite called MongoDB followed by REST. Only MongoDB response time was recorded and REST was missing.

See Also

About

Logging component for loopback with add performance instrumentation for remote methods and datasource calls

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published