@bananakun/sentry-frontend-logger

Logging frontend for Sentry

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
10Mar 22, 2019Jun 15, 2018Minified + gzip package size for @bananakun/sentry-frontend-logger in KB

Readme

frontendLogger

npm version Build Status Coverage Status MIT License

Logging library for SPA and SSR

Getting Started

Install npm package

yarn

yarn add --dev @bananakun/sentry-frontend-logger

npm

npm install -save @bananakun/sentry-frontend-logger

How To Use

please set configuration values for sentry.

https://docs.sentry.io/learn/cli/configuration/

TypeScript

import { SentryLogger, IOptional } from 'sentry-frontend-logger';  
  
const sendError = (e: Error): void => {
  const optional: IOptional = {
    traceId: <TRACE ID>,
    serviceName: <SERVICE NAME>,
    environment: <ENVIRONMENT>,
  };

  const instance = new SentryLogger(<SENTRY DSN>, optional);
  instance.error(e);
};

You set <TRACE ID>, will be trace error with tags on sentry.
The errors are divided name of <ENVIRONMENT>-<SERVICE NAME> on sentry

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.