Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olavoparno/react-use-rapid7
Adds Rapid7 InsightOps hooks to React to keep track of your application
https://github.com/olavoparno/react-use-rapid7
insightops logging monitoring rapid7 react typescript
Last synced: 2 days ago
JSON representation
Adds Rapid7 InsightOps hooks to React to keep track of your application
- Host: GitHub
- URL: https://github.com/olavoparno/react-use-rapid7
- Owner: olavoparno
- License: mit
- Created: 2022-11-28T01:17:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-29T18:10:04.000Z (about 2 years ago)
- Last Synced: 2025-01-01T07:48:56.576Z (8 days ago)
- Topics: insightops, logging, monitoring, rapid7, react, typescript
- Language: TypeScript
- Homepage:
- Size: 407 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# react-use-rapid7
> Adds Rapid7 InsightOps hooks to React
[![NPM](https://img.shields.io/npm/v/react-use-rapid7.svg)](https://www.npmjs.com/package/react-use-rapid7)
---
| Statements | Branches | Functions | Lines |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) |## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Examples](#examples)
- [Documentation](#documentation)
- [Contributors](#contributors)
- [License](#license)---
## Install
```bash
npm install --save react-use-rapid7
```---
## Usage
- You can just call for useRapid7 hook and expect the following parameters:
| key | description | example |
| ------------------------ | ------------------ | ------------------------------------- |
| token | Rapid7's API key | 29189s8asa-skajskj1298sas-kjsaksjak92 |
| rapid7's optional config | Other extra config | { print: true } |---
## Examples
```tsx
const logger = useRapid7('sas1209-cdbb-4afc-b10f-2198sasak', {
print: true,
});aSimplePromise()
.then(() => logger.info('aSimplePromise has been resolved'))
.catch((error) =>
logger.error(`aSimplePromise has errored with ${error.message}`)
);
```---
## Documentation
`useRapid7()` returns a logger with the following methods:
```tsx
type MessageHandler = (
message: string | Record | Error
) => void;type LoggersClientReturn = {
warn: MessageHandler;
error: MessageHandler;
info: MessageHandler;
log: MessageHandler;
};
```You can use a simple string or an object for the message.
---
## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
---
## License
react-use-rapid7 is [MIT licensed](./LICENSE).
---
This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).