UNPKG

@rollbar/react

Version:

Effortlessly track and debug errors in your React applications with Rollbar. This package includes advanced error tracking features and a set of React-specific enhancements to help you identify and fix issues more quickly.

19 lines (16 loc) 718 B
"use client"; import { useEffect } from 'react'; import invariant from './external/tiny-invariant/dist/esm/tiny-invariant.js'; import { LEVEL_INFO } from './constant.js'; import { useRollbar } from './useRollbar.js'; import { isValidLevel } from './utils.js'; function useRollbarCaptureEvent(metadata) { var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : LEVEL_INFO; invariant(isValidLevel(level), "".concat(level, " is not a valid level setting for Rollbar")); var rollbar = useRollbar(); useEffect(function () { rollbar.captureEvent(metadata, level); }, [metadata, level, rollbar]); } export { useRollbarCaptureEvent }; //# sourceMappingURL=useRollbarCaptureEvent.js.map