Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-error-logger

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-error-logger

Log hapi errors

  • 0.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

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

Keywords

FAQs

Package last updated on 16 Jul 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc