https://github.com/yasaichi/hypernova-plugin-server-stacktrace
:pencil: Hypernova plugin for logging a stack trace of error on server-side rendering
https://github.com/yasaichi/hypernova-plugin-server-stacktrace
hypernova logging
Last synced: about 1 year ago
JSON representation
:pencil: Hypernova plugin for logging a stack trace of error on server-side rendering
- Host: GitHub
- URL: https://github.com/yasaichi/hypernova-plugin-server-stacktrace
- Owner: yasaichi
- License: mit
- Created: 2018-12-29T12:39:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:24:20.000Z (over 2 years ago)
- Last Synced: 2024-03-15T11:04:55.139Z (about 2 years ago)
- Topics: hypernova, logging
- Language: TypeScript
- Homepage:
- Size: 396 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# hypernova-plugin-server-stacktrace
[](https://badge.fury.io/js/hypernova-plugin-server-stacktrace)
[](https://travis-ci.org/yasaichi/hypernova-plugin-server-stacktrace)
[](https://codeclimate.com/github/yasaichi/hypernova-plugin-server-stacktrace/maintainability)
[](https://codeclimate.com/github/yasaichi/hypernova-plugin-server-stacktrace/test_coverage)
`hypernova-plugin-server-stacktrace` is a small plugin for [Hypernova](https://github.com/airbnb/hypernova) especially in production.
The plugin enables you to log a stack trace when the server fails to render components.
## Installation
For npm:
```sh
npm install hypernova-plugin-server-stacktrace --save
```
## Usage
Add the plugin object to `plugins` array of the server configuration:
```js
const hypernova = require('hypernova/server');
const ServerStacktracePlugin = require('hypernova-plugin-server-stacktrace');
hypernova({
plugins: [new ServerStacktracePlugin()]
});
```
This will output errors to STDOUT as follows:
```
2019-01-01T08:43:00.647Z - error: TypeError: foo.bar is not a function
at Top (/pass/to/build/pages/webpack:/src/pages/index.tsx:16:1)
at processChild (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2458:14)
at resolve (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2384:5)
at ReactDOMServerRenderer.render (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2706:22)
at ReactDOMServerRenderer.read (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2680:23)
at Object.renderToStaticMarkup (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:3082:25)
at /pass/to/build/pages/webpack:/src/lib/hypernova-react.ts:48:1
at /pass/to/node_modules/hypernova/lib/utils/BatchManager.js:190:18
at tryCatcher (/pass/to/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/pass/to/node_modules/bluebird/js/release/promise.js:512:31)
```
Note that you're able to customize the log format and destination by `logger` or
`loggerInstance`. For further information, please see [the section on server configuration
options](https://github.com/airbnb/hypernova#server).
## Contributing
You should follow the steps below.
1. [Fork the repository](https://help.github.com/articles/fork-a-repo/)
2. Create a feature branch: `git checkout -b add-new-feature`
3. Commit your changes: `git commit -am 'Add new feature'`
4. Push the branch: `git push origin add-new-feature`
5. [Send us a pull request](https://help.github.com/articles/about-pull-requests/)
## License
The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).