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 * Applied as Sentry breadcrumb types. Defaults to `default`.
54 *
55 * @see https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#breadcrumb-types
56 */
57 type?:
58 | 'default'
59 | 'debug'
60 | 'error'
61 | 'navigation'
62 | 'http'
63 | 'info'
64 | 'query'
65 | 'transaction'
66 | 'ui'
67 | 'user'
68
69 /**
70 * Passed through to `Sentry.captureException`
71 *
72 * @see https://github.com/getsentry/sentry-javascript/blob/903addf9a1a1534a6cb2ba3143654b918a86f6dd/packages/types/src/misc.ts#L65
73 */
74 tags?: {
75 [key: string]: number | string | boolean | null | undefined
76 }
77
78 /**
79 * Any additional data, passed through to Sentry as `extra` param on
80 * exceptions, or the `data` param on breadcrumbs.
81 */
82 [key: string]: Serializable | Error | unknown
83}
84
85export type Serializable =
86 | string
87 | number
88 | boolean
89 | null
90 | undefined
91 | Serializable[]
92 | {
93 [key: string]: Serializable
94 }