0.3.1 • Published 3 years ago

hapi-error-logger v0.3.1

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

hapi-error-logger

Build Status Dependency Status

This is a Hapi plugin to log all your response errors automatically using the request.log interface.

usage

  • just register the plugin
import HapiErrorLogger from 'hapi-error-logger';

server
  .register([
    {
      plugin: HapiErrorLogger,
      options: {
        replyWithStack: true,
      },
    },
  ])
  .then(() => {
    // errors are now logged automatically via:
    //
    //    request.log([ 'error' ], error);
  });

plugin api

  • replyWithStack optional, default: false, if set your response will have an error stack attached if available.

error api

  • error.data.skipLogs optional, default: false, if set this error response will not be logged
const Boom = require('boom');

// this is a handler definition
const handler = request => {
  const err = Boom.badGateway('could not reach server XXX', {
    skipLogs: true,
  });

  return err;
};

development

  • npm
npm prune && npm install
npm test
0.3.1

3 years ago

0.3.0

6 years ago

1.0.1

6 years ago

0.2.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago