Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

good-winston-reporter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-winston-reporter

Good reporter usable with winston

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
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

good

FAQs

Package last updated on 05 Jun 2018

Did you know?

Socket

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