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 FeedFeedback = 'feed-feedback',
14 PostSource = 'post-source',
15 AgeAssurance = 'age-assurance',
16 PolicyUpdate = 'policy-update',
17
18 /**
19 * METRIC IS FOR INTERNAL USE ONLY, don't create any other loggers using this
20 * context
21 */
22 Metric = 'metric',
23}
24
25export enum LogLevel {
26 Debug = 'debug',
27 Info = 'info',
28 Log = 'log',
29 Warn = 'warn',
30 Error = 'error',
31}
32
33export type Transport = (
34 level: LogLevel,
35 context: LogContext | undefined,
36 message: string | Error,
37 metadata: Metadata,
38 timestamp: number,
39) => void
40
41/**
42 * A union of some of Sentry's breadcrumb properties as well as Sentry's
43 * `captureException` parameter, `CaptureContext`.
44 */
45export type Metadata = {
46 /**
47 * Reserved for appending `LogContext` in logging payloads
48 */
49 __context__?: undefined
50
51 /**
52 * Applied as Sentry breadcrumb types. Defaults to `default`.
53 *
54 * @see https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#breadcrumb-types
55 */
56 type?:
57 | 'default'
58 | 'debug'
59 | 'error'
60 | 'navigation'
61 | 'http'
62 | 'info'
63 | 'query'
64 | 'transaction'
65 | 'ui'
66 | 'user'
67
68 /**
69 * Passed through to `Sentry.captureException`
70 *
71 * @see https://github.com/getsentry/sentry-javascript/blob/903addf9a1a1534a6cb2ba3143654b918a86f6dd/packages/types/src/misc.ts#L65
72 */
73 tags?: {
74 [key: string]: number | string | boolean | null | undefined
75 }
76
77 /**
78 * Any additional data, passed through to Sentry as `extra` param on
79 * exceptions, or the `data` param on breadcrumbs.
80 */
81 [key: string]: Serializable | Error | unknown
82}
83
84export type Serializable =
85 | string
86 | number
87 | boolean
88 | null
89 | undefined
90 | Serializable[]
91 | {
92 [key: string]: Serializable
93 }