mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import type {Sentry} from '#/logger/sentry'
2
3export enum LogLevel {
4 Debug = 'debug',
5 Info = 'info',
6 Log = 'log',
7 Warn = 'warn',
8 Error = 'error',
9}
10
11export type Transport = (
12 level: LogLevel,
13 message: string | Error,
14 metadata: Metadata,
15 timestamp: number,
16) => void
17
18/**
19 * A union of some of Sentry's breadcrumb properties as well as Sentry's
20 * `captureException` parameter, `CaptureContext`.
21 */
22export type Metadata = {
23 /**
24 * Applied as Sentry breadcrumb types. Defaults to `default`.
25 *
26 * @see https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#breadcrumb-types
27 */
28 type?:
29 | 'default'
30 | 'debug'
31 | 'error'
32 | 'navigation'
33 | 'http'
34 | 'info'
35 | 'query'
36 | 'transaction'
37 | 'ui'
38 | 'user'
39
40 /**
41 * Passed through to `Sentry.captureException`
42 *
43 * @see https://github.com/getsentry/sentry-javascript/blob/903addf9a1a1534a6cb2ba3143654b918a86f6dd/packages/types/src/misc.ts#L65
44 */
45 tags?: {
46 [key: string]:
47 | number
48 | string
49 | boolean
50 | bigint
51 | symbol
52 | null
53 | undefined
54 }
55
56 /**
57 * Any additional data, passed through to Sentry as `extra` param on
58 * exceptions, or the `data` param on breadcrumbs.
59 */
60 [key: string]: unknown
61} & Parameters<typeof Sentry.captureException>[1]
62
63export type ConsoleTransportEntry = {
64 id: string
65 timestamp: number
66 level: LogLevel
67 message: string | Error
68 metadata: Metadata
69}