Type aliases
AnyMap
AnyMap: Record<string, unknown>
CrashEvent
Crash
Event<Context, Metadata>: { context?: Context; event_id?: undefined | string; message?: undefined | string; metadata?: Metadata; name?: undefined | string; stacktrace?: undefined | string; timestamp?: undefined | number }
Type parameters
Type declaration
-
Optional context?: Context
-
Optional event_id?: undefined | string
-
Optional message?: undefined | string
-
Optional metadata?: Metadata
-
Optional name?: undefined | string
-
Optional stacktrace?: undefined | string
-
Optional timestamp?: undefined | number
CrashHunterClientInitOptions
Type parameters
CrashHunterClientOptions
Crash
HunterClientOptions<Context, Metadata>: { debug: boolean; interval: number; max_size: number; metadata: Metadata; node_config: { not_exit_on_uncaught_exception: boolean; not_exit_on_unhandled_rejection: boolean }; request: (data: CrashEvent<Context, Metadata>[]) => Promise<void> }
Type parameters
Type declaration
-
debug: boolean
-
interval: number
-
max_size: number
-
metadata: Metadata
-
node_config: { not_exit_on_uncaught_exception: boolean; not_exit_on_unhandled_rejection: boolean }
-
not_exit_on_uncaught_exception: boolean
-
not_exit_on_unhandled_rejection: boolean
-
request: (data: CrashEvent<Context, Metadata>[]) => Promise<void>
-
- (data: CrashEvent<Context, Metadata>[]): Promise<void>
-
Parameters
Returns Promise<void>
GetLogger
GetLogger: () => Record<"log" | "info" | "warn" | "error", { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void }> & { setDebug: (debug: boolean) => void }
Type declaration
-
- (): Record<"log" | "info" | "warn" | "error", { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void }> & { setDebug: (debug: boolean) => void }
-
Returns Record<"log" | "info" | "warn" | "error", { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void }> & { setDebug: (debug: boolean) => void }
RequiredOptionKey
RequiredOptionKey: "request"
Variables
Let debug
debug: boolean = false
Const methods
methods: ["log", "info", "warn", "error"] = ['log', 'info', 'warn', 'error'] as const
Functions
Const getLogger
- getLogger(): Record<"log" | "info" | "warn" | "error", log> & { setDebug: (debug: boolean) => void }
-
Returns Record<"log" | "info" | "warn" | "error", log> & { setDebug: (debug: boolean) => void }
Object literals
Const CrashHunter
CrashHunter<Context, Metadata>: object
Type parameters
constructor
-
Parameters
-
-
Default value plugins: IPlugin[] = []
Private _enable
_enable: boolean
Private _headCrashEventList
Private _tailCrashEventList
Private Optional _timer
_timer: null | Timeout
Static Private SDK_VERSION
SDK_VERSION: string = (process.env.SDK_VERSION as unknown) as string
init
-
Type parameters
Parameters
-
-
Default value plugins: IPlugin[] = [new BrowserWindowOnerrorPlugin(), new BrowserWindowUnhandledRejectionPlugin()]
Returns ICrashHunter<Context, Metadata>
asyncAttempt
- asyncAttempt<TResult>(func: (...args: any[]) => Promise<TResult>, ...args: any[]): Promise<Error | TResult>
-
Type parameters
Parameters
-
func: (...args: any[]) => Promise<TResult>
-
- (...args: any[]): Promise<TResult>
-
Parameters
Returns Promise<TResult>
-
Rest ...args: any[]
Returns Promise<Error | TResult>
attempt
- attempt<TResult>(func: (...args: any[]) => TResult, ...args: any[]): Error | TResult
-
Type parameters
Parameters
-
func: (...args: any[]) => TResult
-
- (...args: any[]): TResult
-
Parameters
Returns TResult
-
Rest ...args: any[]
Returns Error | TResult
captureException
- captureException(exception: Error, context?: Context): string | undefined
-
Parameters
-
exception: Error
-
Default value context: Context = {} as Context
Returns string | undefined
captureMessage
- captureMessage(message: string, context?: Context, name?: string, stacktrace?: string): string | undefined
-
Parameters
-
message: string
-
Default value context: Context = {} as Context
-
Default value name: string = ""
-
Default value stacktrace: string = ""
Returns string | undefined
close
- close(timeout?: number): Promise<boolean>
-
Parameters
-
Default value timeout: number = 5000
Returns Promise<boolean>
enableDebugLog
- enableDebugLog(enable: boolean): void
flush
- flush(timeout?: number): Promise<boolean>
-
Parameters
-
Default value timeout: number = 5000
Returns Promise<boolean>
setMetadataValue
- setMetadataValue(key: keyof Metadata, value: Metadata[typeof key]): void
-
Parameters
-
key: keyof Metadata
-
value: Metadata[typeof key]
Returns void
Enable debug log. Defaults to
false
.