/** * Sentry-compatible logger shape — `@sentry/browser` can be passed directly. */ export type SDKLogger = { setTag: (key: string, value: string) => void; captureException: (err: unknown, context?: Record) => void; }; /** * Minimal breadcrumb shape forwarded to the internal Sentry sink. Mirrors the * subset of Sentry's `Breadcrumb` the SDK populates, kept local so the logger * stays decoupled from `@sentry/*` — and, more importantly, so it never has to * import the analytics layer (which imports the logger, and would otherwise * form a cycle; see CLAUDE.md §9). * * @internal */ export interface SDKBreadcrumb { /** Breadcrumb grouping key. Always `'sdk.logger'` for logger-sourced crumbs. */ category: string; /** Short, low-cardinality label — the call-site tag passed to `Logger.log.*`. */ message: string; /** Severity. Logger warnings map to `'warning'`. */ level: 'info' | 'warning' | 'error'; /** Already-sanitized structured context. */ data?: Record; } /** * The SDK's own always-on Sentry sink, wired by `initializeSentry` when * analytics is enabled and cleared by `resetAnalytics`. This is deliberately * distinct from the integrator-pluggable {@link SDKLogger} / {@link ILogger} * slots: those belong to the consuming application, this one is the SDK's * internal bridge so its diagnostics reach the partner-usage dashboard without * the integrator having to wire anything. * * Severity policy (implemented in `analytics/sentry.ts`): `error` is captured * as a Sentry issue via `captureException`; `warn` becomes a breadcrumb that * rides along with the next captured event. `info` is intentionally not * forwarded — method-call breadcrumbs from `instrumentClass` already cover the * happy path, and forwarding every info line would only add noise/cost. * * @internal */ export interface SDKSentrySink { /** Forward a (pre-sanitized) error to Sentry as an issue. */ captureException: (error: unknown, context?: Record) => void; /** Forward a (pre-sanitized) breadcrumb to the active Sentry scope. */ addBreadcrumb: (breadcrumb: SDKBreadcrumb) => void; } /** * Structured logger interface (debug/info/warn/error). Sanitization runs * before any method here is invoked, so implementations needn't scrub secrets. * * ```ts * Logger.setStructuredLogger({ * info: (tag, ctx) => pino.info({ tag, ...ctx }), * warn: (tag, ctx) => pino.warn({ tag, ...ctx }), * error: (tag, err, ctx) => pino.error({ tag, err, ...ctx }), * }); * ``` */ export interface ILogger { debug?: (tag: string, context?: Record) => void; info?: (tag: string, context?: Record) => void; warn?: (tag: string, context?: Record) => void; error: (tag: string, error: unknown, context?: Record) => void; } declare function setLogger(customLogger: SDKLogger): void; /** Plug in an `ILogger`. Independent of `setLogger`; pass `null` to clear. */ declare function setStructuredLogger(custom: ILogger | null): void; declare function getLogger(): SDKLogger | null; declare function getStructuredLogger(): ILogger | null; /** * Wire (or clear, with `null`) the SDK's internal Sentry sink. Called by * `initializeSentry` after a successful Sentry init, and reset by * `resetAnalytics`. Not part of the integrator-facing API — applications wire * their own logging through {@link setLogger} / {@link setStructuredLogger}. * * @internal */ declare function setSentrySink(sink: SDKSentrySink | null): void; declare function setDevMode(devMode: boolean): void; declare function isDevMode(): boolean; declare const Logger: { setLogger: typeof setLogger; setStructuredLogger: typeof setStructuredLogger; setSentrySink: typeof setSentrySink; getLogger: typeof getLogger; getStructuredLogger: typeof getStructuredLogger; setDevMode: typeof setDevMode; isDevMode: typeof isDevMode; log: { info: (tag: string, ...args: any[]) => void; warn: (tag: string, ...args: any[]) => void; error: (tag: string, error: unknown, context?: Record) => void; }; }; import * as slack from './slack'; export { slack as Slack, Logger }; export { configureCuratorAlerts, areCuratorAlertsEnabled, CURATOR_ALERTS_DISABLE_ENV_VAR, type ICuratorAlertsConfig, type ICuratorAlertsContext, } from './curator-alert';