/react-logging-error-boundary

A React error boundary that initializes and logs to your logging services

Primary LanguageJavaScriptMIT LicenseMIT

react-logging-error-boundary

npm package

An error boundary component which sends your logs to Sentry and Loggly.

Edit LoggingErrorBoundary

Usage

import React from "react"
import ReactDOM from "react-dom"
import LoggingErrorBoundary from "react-logging-error-boundary"
import GivesError from "./GivesError"
import { ErrorPage } from "./ErrorPage"

function App() {
  return (
    <div className="App">
      <LoggingErrorBoundary
        logService={{
          sentry: {
            dsn: "your sentry dsn"
          },
          loggly: { logglyKey: "your loggly key" }
        }}
        errorComponent={<ErrorPage />}
      >
        <GivesError />
      </LoggingErrorBoundary>
    </div>
  )
}

ReactDOM.render(<App />, document.getElementById("root"))

Properties

Property Type Required Description
logService object no object that contains your sentry and/or loggly configs
errorComponent component yes If something is broken users will see this instead of red box