1.0.1 • Published 4 years ago

@neosjs/electron-sentry v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

@neosjs/electron-sentry

Usage

Installation

npm i @neosjs/electron-sentry

API

Init

const {getSentryReport} =  require('@neosjs/electron-sentry')
const sentryReport = getSentryReport()
let config = { 
  dsn: '', 
  env: '', // default `development`
  version:'' // default `process.env.npm_package_version`
}
sentryReport.init(config)

setUser

Set user information

sentryReport.setUser(userInfo:<object>)

userInfo Identify: id, username, email, ip_address

setTag

Tags are key/value string pairs that are both indexed and searchable. Tags power UI features such as filters and tag-distribution maps. Tags help you quickly access related events and view the tag distribution for a set of events. Common uses for tags include hostname, platform version, and user language.

sentryReport.setTag(key:<string>,value:<string>)
sentryReport.setTag(content:<object>)

setExtra

Set further extras

sentryReport.setExtra(key:<string>,value:<string>)
sentryReport.setExtra(content:<object>)

setContext

sentryReport.setContext(key:<string>,value:<string>)
sentryReport.setContext(content:<object>)

addBreadcrumb

Add a breadcrumb for events

sentryReport.addBreadcrumb(category:<string>, message:<string>, level:<string>)

The level can be set to one of five values, which are, in order of severity: fatal, error, warning, info, and debug.error. default: info

info

Another common operation is to capture a bare message. A message is textual information that should be sent to Sentry. Typically messages are not emitted, but they can be useful for some teams.

sentryReport.info(message:<string>,level:<string>)

error

In JavaScript, you can pass an error object to error() to get it captured as an event. It’s also possible to throw strings as errors, in which case no traceback can be recorded.

In JavaScript you can pass an error object to error() to get it captured as event. It's possible to throw strings as errors in which case no traceback can be recorded.

allow the following context keys to be passed: tags, extra, contexts, user, level, fingerprint.

sentryReport.error(message:<string | object>,context:<object | function>)

eg:

sentryReport.error(new Error("something went wrong"), {
  tags: {
    section: "articles"
  },
  user:{
    username:'xxxxxxx'
  }
})