{"_id":"superstack","_rev":"260003","name":"superstack","description":"long stack traces for node.js","dist-tags":{"latest":"0.0.4"},"maintainers":[{"name":"shtylman","email":"shtylman@gmail.com"}],"time":{"modified":"2021-06-03T16:41:38.000Z","created":"2013-10-15T21:19:06.818Z","0.0.4":"2013-12-05T16:20:18.142Z","0.0.3":"2013-10-16T18:29:49.010Z","0.0.2":"2013-10-16T02:51:17.130Z","0.0.1":"2013-10-15T21:19:06.818Z"},"users":{"mhfrantz":true},"author":{"name":"Roman Shtylman","email":"shtylman@gmail.com"},"repository":{"type":"git","url":"git://github.com/defunctzombie/node-superstack.git"},"versions":{"0.0.4":{"name":"superstack","version":"0.0.4","description":"long stack traces for node.js","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha --ui tdd --reporter list"},"repository":{"type":"git","url":"git://github.com/defunctzombie/node-superstack.git"},"keywords":["stacktrace","long","stack","trace"],"author":{"name":"Roman Shtylman","email":"shtylman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/defunctzombie/node-superstack/issues"},"devDependencies":{"mocha":"~1.13.0","after":"~0.8.1"},"readmeFilename":"README.md","homepage":"https://github.com/defunctzombie/node-superstack","_id":"superstack@0.0.4","dist":{"shasum":"6fe87b7913e0fd748ab33e333b5ae87eb020935c","size":5790,"noattachment":false,"key":"/superstack/-/superstack-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/superstack/download/superstack-0.0.4.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"shtylman","email":"shtylman@gmail.com"},"maintainers":[{"name":"shtylman","email":"shtylman@gmail.com"}],"publish_time":1386260418142,"_cnpm_publish_time":1386260418142,"_hasShrinkwrap":false},"0.0.3":{"name":"superstack","version":"0.0.3","description":"long stack traces for node.js","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha --ui tdd --reporter list"},"repository":{"type":"git","url":"git://github.com/defunctzombie/node-superstack.git"},"keywords":["stacktrace","long","stack","trace"],"author":{"name":"Roman Shtylman","email":"shtylman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/defunctzombie/node-superstack/issues"},"devDependencies":{"mocha":"~1.13.0","after":"~0.8.1"},"readmeFilename":"README.md","_id":"superstack@0.0.3","dist":{"shasum":"f7ae6e0e0a5531a292f335c254adab51dace5365","size":5644,"noattachment":false,"key":"/superstack/-/superstack-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/superstack/download/superstack-0.0.3.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"shtylman","email":"shtylman@gmail.com"},"maintainers":[{"name":"shtylman","email":"shtylman@gmail.com"}],"publish_time":1381948189010,"_cnpm_publish_time":1381948189010,"_hasShrinkwrap":false},"0.0.2":{"name":"superstack","version":"0.0.2","description":"long stack traces for node.js","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha --ui tdd --reporter list"},"repository":{"type":"git","url":"git://github.com/defunctzombie/node-superstack.git"},"keywords":["stacktrace","long","stack","trace"],"author":{"name":"Roman Shtylman","email":"shtylman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/defunctzombie/node-superstack/issues"},"devDependencies":{"mocha":"~1.13.0","after":"~0.8.1"},"readmeFilename":"README.md","_id":"superstack@0.0.2","dist":{"shasum":"82e4e6da42a45c858583145c475c866f6dfc696c","size":5285,"noattachment":false,"key":"/superstack/-/superstack-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/superstack/download/superstack-0.0.2.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"shtylman","email":"shtylman@gmail.com"},"maintainers":[{"name":"shtylman","email":"shtylman@gmail.com"}],"publish_time":1381891877130,"_cnpm_publish_time":1381891877130,"_hasShrinkwrap":false},"0.0.1":{"name":"superstack","version":"0.0.1","description":"long stack traces for node.js","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha --ui tdd --reporter list"},"repository":{"type":"git","url":"git://github.com/defunctzombie/node-superstack.git"},"keywords":["stacktrace","long","stack","trace"],"author":{"name":"Roman Shtylman","email":"shtylman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/defunctzombie/node-superstack/issues"},"devDependencies":{"mocha":"~1.13.0","after":"~0.8.1"},"readmeFilename":"README.md","_id":"superstack@0.0.1","dist":{"shasum":"b654b3972aba2225b9908e83424db60aa6b48ee4","size":4370,"noattachment":false,"key":"/superstack/-/superstack-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/superstack/download/superstack-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"shtylman","email":"shtylman@gmail.com"},"maintainers":[{"name":"shtylman","email":"shtylman@gmail.com"}],"publish_time":1381871946818,"_cnpm_publish_time":1381871946818,"_hasShrinkwrap":false}},"readme":"# superstack [![Build Status](https://travis-ci.org/defunctzombie/node-superstack.png?branch=master)](https://travis-ci.org/defunctzombie/node-superstack)\n\nlong stack traces for node.js over async/io boundaries\n\n## install\n\n```shell\nnpm install superstack\n```\n\n## use\n\nJust require `superstack` in your project. Ideally one of the first requires (see how it works for why)\n\n```js\nvar superstack = require('superstack');\n\nfunction f () {\n    throw new Error('foo');\n}\nsetTimeout(f, Math.random());\nsetTimeout(f, Math.random());\n```\n\nYour stack traces will now extend beyond async call boundaries. From the code above.\n\nBefore superstack\n```\nError: foo\n    at f [as _onTimeout] (.../node-superstack/foobar.js:2:11)\n    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\n```\n\nWe have no idea which `setTimeout` call actually caused the error.\n\nAfter\n```\nError: foo\n    at f (/Users/shtylman/projects/node-superstack/foobar.js:4:11)\n    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\n    at Object.<anonymous> (/Users/shtylman/projects/node-superstack/foobar.js:7:1)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n    at node.js:901:3\n```\n\nNotice that the stacktrace identifies which of the two `setTimeout` fired first and this caused the error.\n\n### options\n\n#### superstack.empty_frame\n\nBy default, the stacktrace appears as one long stacktrace. If you want to see the superstack framing boundaries set this value to a string and it will appear in the callstack.\n\n#### superstack.async_trace_limit\n\nSet this to a positive number to limit the number of frames superstack will capture. This is how many nested async calls back to report. A values of `-1` means unlimited. Default is `10`.\n\n#### superstack.format_stack\n\nFunction used by superstack to format the stacktrace string. See the implementation for default. The default conforms to the v8 stacktrace strings.\n\n## how it works\n\nSuperstack works by intercepting certain node.js EventEmitter, process, and Timer APIs. By intercepting the api call and injecting a wrapper callback, any error can be captured and additional frame information added via [Error.prepareStackTrace](https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi)\n\nThe following calls are intercepted.\n\n### EventEmitter\n\n* on/addListener\n* once\n* removeListener\n* listeners\n\n### process\n\n* nextTick\n* _nextDomainTick\n\n### globals\n\n* setTimeout\n* setInterval\n* setImmediate\n\n## testing\n\nIf you find an instance of usage that is not properly captured, please open an issue and provide a testcase to reproduce.\n\nThe usual `npm test` can be run. A more rigorous set of tests can be run by running the `runme.sh` script in `test/modules`. It will clone a few popular node.js repos and run their test suits with superstack enabled. This helps ensure that there are limited side effects.\n\n## References\n\nThanks to [mattinsler/longjohn](https://github.com/mattinsler/longjohn) and [tlrobinson/long-stack-traces](https://github.com/tlrobinson/long-stack-traces) for the ideas and code. Longjohn code is MIT licensed.\n\nAlso relevant a pdf on the initial idea of [long stack traces](http://nodejs.org/illuminati0.pdf) via an EventSource.\n\n## License\n\nMIT\n","_attachments":{},"readmeFilename":"README.md","homepage":"https://github.com/defunctzombie/node-superstack","bugs":{"url":"https://github.com/defunctzombie/node-superstack/issues"},"license":"MIT"}