Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Repository files navigation

hapi-error-logger

Build StatusDependency Status

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

usage

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

plugin api

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

error api

  • error.data.skipLogsoptional, default: false, if set this error response will not be logged
constBoom=require('boom');// this is a handler definitionconsthandler=request=>{consterr=Boom.badGateway('could not reach server XXX',{skipLogs: true,});returnerr;};

development

  • npm
npm prune && npm install
npm test

About

Log all Hapi errors

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages