本文整理汇总了TypeScript中raven-js.config函数的典型用法代码示例。如果您正苦于以下问题:TypeScript config函数的具体用法?TypeScript config怎么用?TypeScript config使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ravenInstall
export function ravenInstall(sentryDSN: string) {
Raven.config(
sentryDSN,
{
/**
* Clear the path filename to allow Sentry to use map.js file
*
* @see https://gonehybrid.com/how-to-log-errors-in-your-ionic-2-app-with-sentry/
*/
dataCallback: data => {
if (data.culprit) {
data.culprit = data.culprit.substring(data.culprit.lastIndexOf('/'));
}
var stacktrace = data.stacktrace || data.exception && data.exception.values[0].stacktrace;
if (stacktrace) {
stacktrace.frames.forEach(frame => {
frame.filename = frame.filename.substring(frame.filename.lastIndexOf('/'));
});
}
}
}
).install();
}
示例2: default
export default (history: History, dsn: string) => {
const sagaMiddleware: SagaMiddleware<{}> = createSagaMiddleware();
let middlewares: Middleware[] = [];
if (process.env.NODE_ENV !== 'production') {
middlewares = [
createLogger(),
];
}
Raven.config(dsn).install();
const devtools: any = process.env.NODE_ENV !== 'production' && (window as any)._REDUX_DEVTOOLS_EXTENSION__ ?
(window as any)._REDUX_DEVTOOLS_EXTENSION__() : (f: any) => f;
const store = createStore(
createRootReducer(history),
compose(
applyMiddleware(
routerMiddleware(history),
googleAnalytics,
sagaMiddleware,
createRavenMiddleware(Raven, {}),
...middlewares,
),
devtools,
),
);
sagaMiddleware.run(rootSaga);
return store;
};
示例3: init
export function init(sentryDsn: string, appVersion: string): void {
if (Raven.isSetup()) {
throw new IllegalStateError('Error reporter already initialized.');
}
// Breadcrumbs for console logging and XHR may include PII such as the server IP address,
// secret API prefix, or shadowsocks access credentials. Only enable DOM breadcrumbs to receive
// UI click data.
const autoBreadcrumbOptions = {
dom: true,
console: false,
location: false,
xhr: false,
};
Raven.config(sentryDsn, {autoBreadcrumbs: autoBreadcrumbOptions, release: appVersion})
.install();
try {
// tslint:disable-next-line:no-any
window.addEventListener('unhandledrejection', (event: any) => {
Raven.captureException(event.reason);
});
} catch (e) {
// window.addEventListener not available, i.e. not running in a browser
// environment.
// TODO: refactor this code so the try/catch isn't necessary and the
// unhandledrejection listener can be tested.
}
}
示例4: main
function main() {
routes.init()
deepLinks.init()
// cached background images
loadCachedImages()
// cache viewport dims
helper.viewportDim()
// iOs needs this to auto-rotate
window.shouldRotateToOrientation = function() {
return true
}
// pull session data once (to log in user automatically thanks to cookie)
// and also listen to online event in case network was disconnected at app
// startup
if (hasNetwork()) {
onOnline()
}
document.addEventListener('online', onOnline, false)
document.addEventListener('offline', onOffline, false)
document.addEventListener('resume', onResume, false)
document.addEventListener('pause', onPause, false)
document.addEventListener('backbutton', router.backbutton, false)
window.addEventListener('unload', function() {
socket.destroy()
socket.terminate()
})
window.addEventListener('resize', debounce(onResize), false)
// iOs keyboard hack
// TODO we may want to remove this and call only on purpose
window.cordova.plugins.Keyboard.disableScroll(true)
window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false)
if (window.lichess.mode === 'release' && window.lichess.sentryDSN) {
Raven.config(window.lichess.sentryDSN, {
release: window.AppVersion ? window.AppVersion.version : 'snapshot-dev'
}).install()
}
if (cordova.platformId === 'android') {
window.StatusBar.backgroundColorByHexString('#151A1E')
}
setTimeout(function() {
window.navigator.splashscreen.hide()
}, 500)
}
示例5: constructor
constructor(
private configService: ConfigService
) {
super();
this.config = configService.config;
if (!this.config.isLocal) {
const options = { 'release': configService.config.version, 'autoBreadcrumbs': { 'xhr': false }};
Raven
.config(this.config.ravenDsn, options)
.install();
}
}
示例6: main
function main() {
routes.init()
deepLinks.init()
// cached background images
loadCachedImages()
// cache viewport dims
helper.viewportDim()
// iOs needs this to auto-rotate
window.shouldRotateToOrientation = () => {
return true
}
// pull session data once (to log in user automatically thanks to cookie)
// and also listen to online event in case network was disconnected at app
// startup
if (hasNetwork()) {
onOnline()
} else {
session.restoreStoredSession()
}
document.addEventListener('online', onOnline, false)
document.addEventListener('offline', onOffline, false)
document.addEventListener('resume', onResume, false)
document.addEventListener('pause', onPause, false)
document.addEventListener('backbutton', router.backbutton, false)
window.addEventListener('unload', () => {
socket.destroy()
socket.terminate()
})
window.addEventListener('resize', debounce(onResize), false)
window.Keyboard.hideKeyboardAccessoryBar(false)
if (globalConfig.mode === 'release' && globalConfig.sentryDSN) {
Raven.config(globalConfig.sentryDSN, {
release: window.AppVersion ? window.AppVersion.version : 'snapshot-dev'
}).install()
}
setTimeout(() => {
window.navigator.splashscreen.hide()
}, 500)
}
示例7: call
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './in-memory-data.service';
import './rxjs-extensions';
import { AppComponent } from './app.component';
import { AppRoutingModule, routedComponents } from './app-routing.module';
import { HeroService } from './hero.service';
import { HeroSearchComponent } from './hero-search.component';
import Raven from 'raven-js';
// var Raven = require('raven-js'); // works (?)
Raven.config('http://abcdef@example.com/1').install();
class RavenExceptionHandler {
call(err:any) {
Raven.captureException(err.originalException);
}
}
@NgModule({
imports: [
BrowserModule,
FormsModule,
AppRoutingModule,
HttpModule,
InMemoryWebApiModule.forRoot(InMemoryDataService, { delay: 600 })
],
示例8: handleError
import { HttpErrorResponse } from '@angular/common/http';
import { ErrorHandler } from '@angular/core';
import { BadInputError } from 'app/error/bad-input-error';
import { BaseError } from 'app/error/base-error';
import { ForbiddenError } from 'app/error/forbidden-error';
import { NotFoundError } from 'app/error/not-found-error';
import { UnreachableError } from 'app/error/unreachable-error';
import * as Raven from 'raven-js';
import { environment } from '../../environments/environment';
import { CustomError } from './custom-error';
Raven
.config(environment.sentryDns)
.install();
export class AppErrorHandler implements ErrorHandler {
handleError(err) {
let error: any = null;
let message: any = null;
if (err instanceof CustomError) {
error = err.originalError;
message = err.message;
} else {
error = err;
}
if (error instanceof HttpErrorResponse) {
message = 'BACKEND: ' + message
示例9: log
import {Injectable} from '@angular/core';
import * as Raven from 'raven-js';
import {LogLevel as RavenLogLevel, RavenOptions} from 'raven-js';
import {LogLevel} from './log-level';
Raven
.config('https://bd6aba79ca514d35bb06a4b4e0c2a21e@sentry.io/1242399')
.install();
@Injectable({
providedIn: 'root'
})
export class LoggingService {
constructor() {
}
public log(message: string, logLevel: LogLevel) {
let options: RavenOptions;
options = {};
options.level = this.translateLogLevel(logLevel);
this.ravenCaptureMessage(message, options);
}
public debug(message: string) {
this.log(message, LogLevel.DEBUG);
}
public info(message: string) {
示例10:
const configureRaven = () => {
if (process.env.NODE_ENV === 'production') {
let dns = 'aHR0cHM6Ly85NTZmODkwNDdhYTk0ZGQ1ODU4Mjg0N2E5YjVjMzliZEBzZW50cnkuaW8vMTE5NzU5OA==';
Raven.config(b64DecodeUnicode(dns)).install();
}
};