forked from rollbar/rollbar.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
69 lines (61 loc) · 2.48 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Type definitions for rollbar 2.1.1
// Project: Rollbar
/*~ This is the module template file for class modules.
*~ You should rename it to index.d.ts and place it in a folder with the same name as the module.
*~ For example, if you were writing a file for "super-greeter", this
*~ file should be 'super-greeter/index.d.ts'
*/
export = Rollbar;
declare class Rollbar {
constructor(options?: Rollbar.Configuration);
static init(options: Rollbar.Configuration): Rollbar;
public global(options: Rollbar.Configuration): Rollbar;
public configure(options: Rollbar.Configuration): Rollbar;
public lastError(): Rollbar.MaybeError;
public log(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public debug(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public info(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public warn(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public warning(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public error(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public critical(...args: Rollbar.LogArgument[]): Rollbar.LogResult;
public captureEvent(metadata: object, level: Rollbar.Level): Rollbar.TelemetryEvent;
public lambdaHandler(handler: Rollbar.LambdaHandler): Rollbar.LambdaHandler;
}
declare namespace Rollbar {
export type LambdaHandler = (event: object, context: object, callback: Callback) => void;
export type MaybeError = Error | undefined | null;
export type Level = "debug" | "info" | "warning" | "error" | "critical";
export interface Configuration {
accessToken?: string;
version?: string;
scrubFields?: string[];
logLevel?: Level;
reportLevel?: Level;
uncaughtErrorLevel?: Level;
endpoint?: string;
verbose?: boolean;
enabled?: boolean;
captureUncaught?: boolean;
captureUnhandledRejections?: boolean;
payload?: object;
maxItems?: number;
itemsPerMinute?: number;
ignoredMessages?: string[];
hostWhiteList?: string[];
hostBlackList?: string[];
}
export type Callback = (err: MaybeError, response: object) => void;
export type LogArgument = string | Error | object | Callback | Date | any[];
export interface LogResult {
uuid: string;
}
export interface TelemetryEvent {
level: Level;
type: string;
timestamp_ms: number;
body: object;
source: string;
uuid?: string;
}
}