UNPKG

5 kBTypeScriptView Raw
1import { Breadcrumb, CaptureContext, CustomSamplingContext, Event, EventHint, Extra, Extras, Primitive, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
2import { Hub } from './hub';
3import { Scope } from './scope';
4/**
5 * Captures an exception event and sends it to Sentry.
6 *
7 * @param exception An exception-like object.
8 * @param captureContext Additional scope data to apply to exception event.
9 * @returns The generated eventId.
10 */
11export declare function captureException(exception: any, captureContext?: CaptureContext): ReturnType<Hub['captureException']>;
12/**
13 * Captures a message event and sends it to Sentry.
14 *
15 * @param message The message to send to Sentry.
16 * @param Severity Define the level of the message.
17 * @returns The generated eventId.
18 */
19export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): ReturnType<Hub['captureMessage']>;
20/**
21 * Captures a manually created event and sends it to Sentry.
22 *
23 * @param event The event to send to Sentry.
24 * @returns The generated eventId.
25 */
26export declare function captureEvent(event: Event, hint?: EventHint): ReturnType<Hub['captureEvent']>;
27/**
28 * Callback to set context information onto the scope.
29 * @param callback Callback function that receives Scope.
30 */
31export declare function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']>;
32/**
33 * Records a new breadcrumb which will be attached to future events.
34 *
35 * Breadcrumbs will be added to subsequent events to provide more context on
36 * user's actions prior to an error or crash.
37 *
38 * @param breadcrumb The breadcrumb to record.
39 */
40export declare function addBreadcrumb(breadcrumb: Breadcrumb): ReturnType<Hub['addBreadcrumb']>;
41/**
42 * Sets context data with the given name.
43 * @param name of the context
44 * @param context Any kind of data. This data will be normalized.
45 */
46export declare function setContext(name: string, context: {
47 [key: string]: any;
48} | null): ReturnType<Hub['setContext']>;
49/**
50 * Set an object that will be merged sent as extra data with the event.
51 * @param extras Extras object to merge into current context.
52 */
53export declare function setExtras(extras: Extras): ReturnType<Hub['setExtras']>;
54/**
55 * Set key:value that will be sent as extra data with the event.
56 * @param key String of extra
57 * @param extra Any kind of data. This data will be normalized.
58 */
59export declare function setExtra(key: string, extra: Extra): ReturnType<Hub['setExtra']>;
60/**
61 * Set an object that will be merged sent as tags data with the event.
62 * @param tags Tags context object to merge into current context.
63 */
64export declare function setTags(tags: {
65 [key: string]: Primitive;
66}): ReturnType<Hub['setTags']>;
67/**
68 * Set key:value that will be sent as tags data with the event.
69 *
70 * Can also be used to unset a tag, by passing `undefined`.
71 *
72 * @param key String key of tag
73 * @param value Value of tag
74 */
75export declare function setTag(key: string, value: Primitive): ReturnType<Hub['setTag']>;
76/**
77 * Updates user context information for future events.
78 *
79 * @param user User context object to be set in the current context. Pass `null` to unset the user.
80 */
81export declare function setUser(user: User | null): ReturnType<Hub['setUser']>;
82/**
83 * Creates a new scope with and executes the given operation within.
84 * The scope is automatically removed once the operation
85 * finishes or throws.
86 *
87 * This is essentially a convenience function for:
88 *
89 * pushScope();
90 * callback();
91 * popScope();
92 *
93 * @param callback that will be enclosed into push/popScope.
94 */
95export declare function withScope(callback: (scope: Scope) => void): ReturnType<Hub['withScope']>;
96/**
97 * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
98 *
99 * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
100 * new child span within the transaction or any span, call the respective `.startChild()` method.
101 *
102 * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
103 *
104 * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its
105 * finished child spans will be sent to Sentry.
106 *
107 * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call
108 * `startTransaction` directly on the hub.
109 *
110 * @param context Properties of the new `Transaction`.
111 * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
112 * default values). See {@link Options.tracesSampler}.
113 *
114 * @returns The transaction which was just started
115 */
116export declare function startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): ReturnType<Hub['startTransaction']>;
117//# sourceMappingURL=exports.d.ts.map
\No newline at end of file