Tool for recording logs in react js using a third party or custom API

Usage no npm install needed!

<script type="module">
  import nerrewtonSpringReactLogger from 'https://cdn.skypack.dev/@nerrewton/spring_react_logger';


Spring React Logger

This is a package for capturing error messages and tracking their origin, we include at first Sentry as a third party company for logging purposes but it can support others APIs.


npm install @nerrewton/spring_react_logger

Usage for React

import React from "react"
import ReactDOM from 'react-dom'
import { init as initSpringLogger, ReactSentryLogger } from "@nerrewton/spring_react_logger"
import App from './App';

// SpringLogger inicialization for React Sentry API
initSpringLogger( new ReactSentryLogger("http:<url external API>") )

    <App />
import React from "react"
import { write as writeSpringLogger } from "@nerrewton/spring_react_logger"

const App = () => {
    const errorFunction = () => {
        throw new Error("This is my first Error!") // This error will be captured by default

    const handleClick = () => {
            throw new Error("This is my first info Error!")
            writeSpringLogger("info", e) // This is an example of trigger an error manually

    return (
        <button type="button" className="btnErrorClass" onClick={ errorFunction }>Break the world</button>
        <button type="button" className="btnInfoClass" onClick={ handleClick }>Trigger an info error</button>

export default App;