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