当前位置: 首页 > 软件库 > 手机/移动开发 > >

nativescript-sentry

Sentry java/cocoa for nativescript
授权协议 Apache-2.0 License
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 云炜
操作系统 iOS
开源组织
适用人群 未知
 软件概览

This project is not mantained anymore, check this one out https://github.com/FinanzRitter/nativescript-sentry

Sentry.io for NativeScript

This plugin uses sentry-android and sentry-cocoa to catch native errors/stack traces and send them to a sentry server.

NOTE: If you have a native exeption and the app exits the plugin will save the log and send it in the next app startup, this is how the native plugins are implemented and it is expected behavior

Android SLF4J Log Error

Sentry has an optional dependency on SLF4J on Android.Which when not present will log an error about it not being in the application.

System.err: SLF4J: Failed to load class >"org.slf4j.impl.StaticLoggerBinder".
System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder >for further details.

To get rid of this log warning you can add a dependency to your app's app.gradle file located in App_Resources/Android/app.gradle to include:

 compile 'org.slf4j:slf4j-nop:1.7.25'

in the dependencies. See the demo app here

Installation

tns plugin add nativescript-sentry

Config

Without Angular

import { Sentry } from 'nativescript-sentry';
const dsn = 'https://<key>:<secret>@host/<project>';
Sentry.init(dsn);

With Angular

import { SentryModule } from 'nativescript-sentry/angular';

NgModule({
  ...
  imports: [
       SentryModule.forRoot({dsn: 'https://<key>:<secret>@host/<project>'})
  ],

Note: this plugin adds a custom ErrorHandler to your angular app

API

Capture Exception

Sentry.captureException(exeption: Error, options?: ExceptionOptions);

Example:

try {
  throw 'try catch Exception example';
} catch (error) {
  Sentry.captureException(error, {});
}

Capture Message

Sentry.captureMessage(message: string, options?: MessageOptions)

Capture BreadCrumb

Sentry.captureBreadcrumb(breadcrumb: BreadCrumb)

Set Context user

Sentry.setContextUser(user: SentryUser)

Context Tags

Sentry.setContextTags(tags: object)

Context Extra

Sentry.setContextExtra(extra: object)

Clear context

Sentry.clearContext();

Enums

export enum Level {
  Fatal = 'fatal',
  Error = 'error',
  Warning = 'warning',
  Info = 'info',
  Debug = 'debug'
}

Interfaces

export interface SentryUser {
  id: string;
  email?: string;
  username?: string;
}

export interface BreadCrumb {
  message: string;
  category: string;
  level: Level;
}

export interface MessageOptions {
  level?: Level;

  /**
   * Object of additional Key/value pairs which generate breakdowns charts and search filters.
   */
  tags?: object;

  /**
   * Object of unstructured data which is stored with events.
   */
  extra?: object;
}

export interface ExceptionOptions {
  /**
   * Object of additional Key/value pairs which generate breakdowns charts and search filters in Sentry.
   */
  tags?: object;

  /**
   * Object of unstructured data which is stored with events.
   */
  extra?: object;
}

Next features:

  • callback for events

Changelog:

2/2/2019 - (1.8.0):

  • bumps to latest native SDK releases
  • implements improved data converter(#22)
  • adds data to SentryUser

Thanks to @bradmartin and @jerbob92!

28/11/2018 - (1.6.1):

  • back to native approach thanks to @bradmartin
  • update dependencies
  • update test app
  • working native breadcrums for ios
  • fix dsn init thanks to @kvnvelasco

11/12/2017 - (1.5.0):

BREAKING CHANGES

  • capture() method was deprecated in favor of captureMessage/captureException

Features

  • Moving to an hybrid approach with both clients(web/native)
  • breadcrums
  • tags
  • user info
  • set tags and extra for each event

28-08-2017 - (1.3.0):

  • fix Aot compilation for angular apps
  • fix typos thanks to @muratcorlu

2-08-2017 - (1.2.0):

  • update demos dependencies
  • update ios and android native dependencies
  • fix ios event capture

24-07-2017 - (1.1.0):

  • fix stringify
  • fix angular error handler

Credits:

  • @hypery2k: for his nativescript-fabric(helped me a lot!)
  • 本文主要记录安装和配置Sentry的过程,关于Sentry的介绍,请参考Apache Sentry架构介绍。 1. 环境说明 系统环境: 操作系统:CentOs 6.6 Hadoop版本:CDH5.4 运行用户:root 这里,我参考使用yum安装CDH Hadoop集群一文搭建了一个测试集群,并选择cdh1节点来安装sentry服务。 2. 安装 在cdh1节点上运行下面命令查看Sentry的相

  • 安装和配置Sentry 本文主要记录安装和配置Sentry的过程,关于Sentry的介绍,请参考 Apache Sentry架构介绍 。 1. 环境说明 系统环境: 操作系统:CentOs 6.6 Hadoop版本: CDH5.4 运行用户:root 这里,我参考 使用yum安装CDH Hadoop集群 一文搭建了一个测试集群,并选择cdh1节点来安装sentry服务。 2. 安装 在cdh1节点

  • 本文主要记录安装和配置Sentry的过程,关于Sentry的介绍,请参考Apache Sentry架构介绍。 1. 环境说明 系统环境: 操作系统:CentOs 6.6 Hadoop版本:CDH5.4 运行用户:root 这里,我参考使用yum安装CDH Hadoop集群一文搭建了一个测试集群,并选择cdh1节点来安装sentry服务。 2. 安装 在cdh1节点上运行下面命令查看Sentry的相

  • Error: listen EADDRINUSE: address already in use :::8081     at Server.setupListenHandle [as _listen2] (net.js:1226:14)     at listenInCluster (net.js:1274:12)     at Server.listen (net.js:1362:7)    

 相关资料
  • NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive

  • NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native

  • NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t

  • Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a

  • NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na

  • NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat

  • This project has moved: This project is now being maintained here: https://github.com/nativescript-community/ui-mapboxas it's become clear contrary to what I thought, I don't actually have enough time

  • Nativescript Hijri plugin This plugin is inspired by https://github.com/arabiaweather/hijri-date Nativescript-hijri Hijri plugin allow you to convert gregorian date to islamic hijri date. Installation