mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1/**
2 * DO NOT IMPORT THIS DIRECTLY
3 *
4 * Logger contexts, defined here and used via `Logger.Context.*` static prop.
5 */
6export enum LogContext {
7 Default = 'logger',
8 Session = 'session',
9 Notifications = 'notifications',
10 ConversationAgent = 'conversation-agent',
11 DMsAgent = 'dms-agent',
12 ReportDialog = 'report-dialog',
13
14 /**
15 * METRIC IS FOR INTERNAL USE ONLY, don't create any other loggers using this
16 * context
17 */
18 Metric = 'metric',
19}
20
21export enum LogLevel {
22 Debug = 'debug',
23 Info = 'info',
24 Log = 'log',
25 Warn = 'warn',
26 Error = 'error',
27}
28
29export type Transport = (
30 level: LogLevel,
31 context: LogContext | undefined,
32 message: string | Error,
33 metadata: Metadata,
34 timestamp: number,
35) => void
36
37/**
38 * A union of some of Sentry's breadcrumb properties as well as Sentry's
39 * `captureException` parameter, `CaptureContext`.
40 */
41export type Metadata = {
42 /**
43 * Reserved for appending `LogContext` in logging payloads
44 */
45 __context__?: undefined
46
47 /**
48 * Applied as Sentry breadcrumb types. Defaults to `default`.
49 *
50 * @see https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#breadcrumb-types
51 */
52 type?:
53 | 'default'
54 | 'debug'
55 | 'error'
56 | 'navigation'
57 | 'http'
58 | 'info'
59 | 'query'
60 | 'transaction'
61 | 'ui'
62 | 'user'
63
64 /**
65 * Passed through to `Sentry.captureException`
66 *
67 * @see https://github.com/getsentry/sentry-javascript/blob/903addf9a1a1534a6cb2ba3143654b918a86f6dd/packages/types/src/misc.ts#L65
68 */
69 tags?: {
70 [key: string]: number | string | boolean | null | undefined
71 }
72
73 /**
74 * Any additional data, passed through to Sentry as `extra` param on
75 * exceptions, or the `data` param on breadcrumbs.
76 */
77 [key: string]: Serializable | Error | unknown
78}
79
80export type Serializable =
81 | string
82 | number
83 | boolean
84 | null
85 | undefined
86 | Serializable[]
87 | {
88 [key: string]: Serializable
89 }