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