# hapi-error-logger

> Log hapi errors

Latest version **0.3.1** (published 2021-07-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install hapi-error-logger
pnpm add hapi-error-logger
yarn add hapi-error-logger
bun add hapi-error-logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2021-07-16 |
| First published | 2016-06-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^8.9.0 |
| Dependencies | 1 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | blogfoster GmbH |
| Maintainers | dominicumbeer, alexanderbeletsky, vendura, anton-syrovatka, simon.staib, gabriel-r, pewlowz, eneax |
| Keywords | hapi, hapi-plugin, plugin, logging, errors, error-logger |

## Links

- npm: https://www.npmjs.com/package/hapi-error-logger
- Repository: https://github.com/blogfoster/hapi-error-logger
- Homepage: https://github.com/blogfoster/hapi-error-logger#readme
- Issues: https://github.com/blogfoster/hapi-error-logger/issues
- npm.io page: https://npm.io/package/hapi-error-logger

## Dependencies (1)

- [joi](https://npm.io/package/joi.md) ^13.4.0

## Recent versions

- 0.3.1 (latest) — 2021-07-16
- 0.3.0 — 2018-06-07
- 1.0.1 — 2018-06-06
- 0.2.0 — 2017-04-19
- 0.1.2 — 2016-07-26
- 0.1.1 — 2016-06-01
- 0.1.0 — 2016-06-01

## README

# hapi-error-logger

[![Build Status](https://travis-ci.org/blogfoster/hapi-error-logger.svg?branch=master)](https://travis-ci.org/blogfoster/hapi-error-logger)
[![Dependency Status](https://david-dm.org/blogfoster/hapi-error-logger.svg)](https://david-dm.org/blogfoster/hapi-error-logger)

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

## usage

- just register the plugin

```javascript
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

```js
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

```bash
npm prune && npm install
npm test
```

---
_Source: https://npm.io/package/hapi-error-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
