# longjohn

> Long stack traces for node.js inspired by https://github.com/tlrobinson/long-stack-traces

Latest version **0.2.12** (published 2017-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install longjohn
pnpm add longjohn
yarn add longjohn
bun add longjohn
```

## 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.2.12 |
| Published | 2017-01-18 |
| First published | 2012-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.9.3 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 838 |
| Author | Matt Insler |
| Maintainers | mattinsler |

## Links

- npm: https://www.npmjs.com/package/longjohn
- Repository: https://github.com/mattinsler/longjohn
- Issues: https://github.com/mattinsler/longjohn/issues
- npm.io page: https://npm.io/package/longjohn

## Dependencies (1)

- [source-map-support](https://npm.io/package/source-map-support.md) 0.3.2 - 1.0.0

## Recent versions

- 0.2.12 (latest) — 2017-01-18
- 0.2.11 — 2015-12-01
- 0.2.10 — 2015-11-16
- 0.2.9 — 2015-09-15
- 0.2.8 — 2015-08-12
- 0.2.7 — 2015-07-01
- 0.2.6 — 2015-06-30
- 0.2.5 — 2015-06-29
- 0.2.4 — 2014-03-28
- 0.2.3 — 2014-03-27
- 0.2.2 — 2013-10-29
- 0.2.1 — 2013-07-15
- 0.2.0 — 2013-03-14
- 0.0.5 — 2013-03-09
- 0.0.4 — 2012-11-16
- … 3 more at https://npm.io/package/longjohn/versions

## README

# longjohn

Long stack traces for [node.js](http://nodejs.org/) with configurable call trace length

## Inspiration

I wrote this while trying to add [long-stack-traces](https://github.com/tlrobinson/long-stack-traces) to my server and realizing that there were issues with support of [EventEmitter::removeListener](http://nodejs.org/api/events.html#events_emitter_removelistener_event_listener).  The node HTTP Server will begin to leak callbacks and any of your own code that relies on removing listeners would not work as anticipated.

So what to do...  I stole the code and rewrote it.  I've added support for removeListener along with the ability to cut off the number of async calls the library will trace.  I hope you like it!

Please thank [tlrobinson](https://github.com/tlrobinson) for the initial implementation!

## Production Use

Longjohn collects a large amount of data in order to provide useful stack traces. While it is very helpful in
development and testing environments, it is not recommended to use longjohn in production. The data collection puts
a lot of strain on V8's garbage collector and can greatly slow down heavily-loaded applications.

## Installation

Just npm install it!

```bash
$ npm install longjohn
```

## Usage

To use longjohn, require it in your code (probably in some initialization code).  That's all!

```javascript
if (process.env.NODE_ENV !== 'production'){
  require('longjohn');
}

// ... your code
```

## Options

#### Limit traced async calls

```javascript
longjohn.async_trace_limit = 5;   // defaults to 10
longjohn.async_trace_limit = -1;  // unlimited
```

#### Change callback frame text

```javascript
longjohn.empty_frame = 'ASYNC CALLBACK';  // defaults to '---------------------------------------------'
```

## Use with Source Maps

As of version 0.2.9 longjonn supports source maps. Just compile your code down to
javascript with source map support and run like normal.

For coffee-script, this would look like:

```bash
$ coffee --map --compile script.coffee
```

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