diff --git a/typescript/raven-tests.ts b/typescript/raven-tests.ts index 3b3bf6a05eb4..14cca927704f 100644 --- a/typescript/raven-tests.ts +++ b/typescript/raven-tests.ts @@ -19,7 +19,13 @@ var options = { whitelistUrls: [ /https?:\/\/google\.com/, 'https://www.google.com' - ] + ], + autoBreadcrumbs: { + xhr: false, + console: false, + dom: true, + location: false + } }; Raven.config('https://public@sentry.io/1', options).install(); @@ -55,7 +61,9 @@ var err:Error = Raven.lastException(); Raven.captureMessage('Broken!'); Raven.captureMessage('Broken!', {tags: { key: "value" }}); +Raven.captureMessage('Broken!', { stacktrace: true }); -Raven.captureBreadcrumb({}); +Raven.captureBreadcrumb({ + message: "This is a breadcrumb message." +}); Raven.setRelease('abc123'); Raven.setEnvironment('production'); diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 3bdce3fddb4b..8f9eef084cd1 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -8,7 +8,7 @@ export = Raven; interface RavenOptions { /** The log level associated with this event. Default: error */ - level?: string; + level?: LogLevel; /** The name of the logger used by Sentry. Default: javascript */ logger?: string; @@ -64,6 +64,9 @@ interface RavenOptions { /** Enables/disables instrumentation of globals. */ instrument?: boolean | RavenInstrumentationOptions; + + /** Enables/disables automatic collection of breadcrumbs. */ + autoBreadcrumbs?: boolean | AutoBreadcrumbOptions } interface RavenInstrumentationOptions { @@ -168,7 +171,7 @@ interface RavenStatic { captureMessage(msg: string, options?: RavenOptions): RavenStatic; /** Log a breadcrumb */ - captureBreadcrumb(crumb: Object): RavenStatic; + captureBreadcrumb(crumb: Breadcrumb): RavenStatic; /** * Clear the user context, removing the user data that would be sent to Sentry. @@ -245,3 +248,22 @@ interface RavenTransportOptions { interface RavenPlugin { (raven: RavenStatic, ...args: any[]): RavenStatic; } + +interface Breadcrumb { + message?: string; + category?: string; + level?: LogLevel; + data?: any; + type?: BreadcrumbType +} + +type BreadcrumbType = "navigation" | "http"; + +interface AutoBreadcrumbOptions { + xhr?: boolean; + console?: boolean; + dom?: boolean; + location?: boolean; +} + +type LogLevel = "critical" | "error" | "warn" | "info" | "debug"; \ No newline at end of file