https://github.com/outmoded/poop
hapi plugin for handling uncaught exceptions
https://github.com/outmoded/poop
Last synced: 11 months ago
JSON representation
hapi plugin for handling uncaught exceptions
- Host: GitHub
- URL: https://github.com/outmoded/poop
- Owner: outmoded
- License: other
- Archived: true
- Created: 2013-05-24T23:26:03.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2019-01-21T15:53:40.000Z (about 7 years ago)
- Last Synced: 2024-11-08T12:43:01.389Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 88.9 KB
- Stars: 115
- Watchers: 28
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-repos - outmoded/poop - hapi plugin for handling uncaught exceptions (JavaScript)
README

[`hapi`](https://github.com/hapijs/hapi) plugin for taking a process dump and cleaning up after an uncaught exception
[](https://www.npmjs.org/package/poop)
[](http://travis-ci.org/hapijs/poop)
Lead Maintainer: [Colin Ihrig](https://github.com/cjihrig)
## Table of Contents
- [Overview](#overview)
- [Example](#example)
- [Settings](#settings)
- [`heapdumpFolder`](#heapdumpfolder)
- [`logPath`](#logpath)
- [`writeStreamOptions`](#writestreamoptions)
## Overview
When an `uncaughtException` is encountered a heap dump will be output to the
plugin folder. A log file is also written containing the exception details.
After this is complete the process will exit with a failure code. Heap dumps can
also be taken at arbitrary times by sending a `SIGUSR1` signal to the server
process.
## Example
The following example shows how to register and configure `poop`. In this example,
an uncaught exception is thrown after `poop` is registered. This will trigger a
heap dump and `poop.log` file to be created.
```javascript
'use strict';
var Path = require('path');
var Hapi = require('hapi');
var Poop = require('poop');
var server = new Hapi.Server();
server.register({
register: Poop,
options: {
logPath: Path.join(__dirname, 'poop.log')
}
}, function () {
throw new Error('uncaught');
});
```
## Settings
The following options are available when configuring `poop`.
### `heapdumpFolder`
The directory to place heap dump files. Defaults to the process current working directory.
### `logPath`
The file path to log any uncaught exception errors. Defaults to `poop.log` in
the process current working directory.
### `writeStreamOptions`
Options passed to the write stream of the log file. Uses Node's defaults:
```javascript
{
flags: 'w',
encoding: null,
fd: null,
mode: 0666
}
```