Socket
Socket
Sign inDemoInstall

good-winston-reporter

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    good-winston-reporter

Good reporter usable with winston


Version published
Weekly downloads
74
increased by64.44%
Maintainers
1
Install size
836 kB
Created
Weekly downloads
 

Readme

Source

good-winston-reporter pipeline status

A new reporter for good, that uses winston.

Settings

How to set log level

Use the event as key, and the level as value

var options = {
  opsInterval  : 5000,
  reporters    : [{
    reporter   : GoodWinstonReporter,
    events     : {
      log      : 'info',
      request  : 'debug',
      response : 'debug',
      error    : 'error',
      ops      : 'verbose'
    },
    config     : {
      logger   : winston
    }
  }]
};
How to set default log level

Set '*' as value for an event.

var defaultOptions = {
  log      : 'info',
  request  : 'debug',
  response : 'debug',
  error    : 'error',
  ops      : 'silly'
};
Skip event type

To skip an event, you just have to not include it when you load the plugin.

Example

It will keep only ops and error

var defaultOptions = {
  error    : 'error',
  ops      : 'silly'
};
Available logs level

Same as winston levels, but you can't enforce custom levels (currently):

silly, debug, verbose, info, warn, error

Get started

Here a piece of code to help you integrate this module into your pretty Hapi server.

'use strict';

var Hapi                = require('hapi');
var winston             = require('winston');
var server              = new Hapi.Server();
var GoodWinstonReporter = require('good-winston-reporter');

server.connection({ host: 'localhost', port: 3000 });

var options = {
  opsInterval  : 5000,
  reporters    : [{
    reporter   : GoodWinstonReporter,
    events     : {
      log      : 'info',
      request  : '*', // will use default level
      response : '*', // will use default level
      error    : 'error',
      ops      : 'verbose'
    },
    config     : {
      logger   : winston
    }
  }]
};

server.register({
  register : require('good'),
  options  : options
}, function (err) {
  if (err) {
    winston.error(err);
  }
  else {
    server.start(function () {
      winston.info('Server started at ' + server.info.uri);
    });
  }
});

Keywords

FAQs

Last updated on 05 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc