WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto
at root/atb-56-theme-caching-layer 41 lines 1.5 kB view raw
1import { SeverityNumber } from "@opentelemetry/api-logs"; 2 3/** Log severity levels in ascending order. */ 4export type LogLevel = "debug" | "info" | "warn" | "error" | "fatal"; 5 6/** Map from LogLevel to OTel SeverityNumber. */ 7export const SEVERITY_MAP: Record<LogLevel, SeverityNumber> = { 8 debug: SeverityNumber.DEBUG, 9 info: SeverityNumber.INFO, 10 warn: SeverityNumber.WARN, 11 error: SeverityNumber.ERROR, 12 fatal: SeverityNumber.FATAL, 13}; 14 15/** Attributes that can be attached to log records. */ 16export type LogAttributes = Record<string, unknown>; 17 18/** Options for creating a logger. */ 19export interface CreateLoggerOptions { 20 /** Service name (e.g., "atbb-appview"). */ 21 service: string; 22 /** Service version (e.g., "0.1.0"). */ 23 version?: string; 24 /** Deployment environment (e.g., "production", "development"). */ 25 environment?: string; 26 /** Minimum log level. Defaults to "info". */ 27 level?: LogLevel; 28} 29 30/** Structured logger interface. */ 31export interface Logger { 32 debug(message: string, attributes?: LogAttributes): void; 33 info(message: string, attributes?: LogAttributes): void; 34 warn(message: string, attributes?: LogAttributes): void; 35 error(message: string, attributes?: LogAttributes): void; 36 fatal(message: string, attributes?: LogAttributes): void; 37 /** Create a child logger with additional base attributes. */ 38 child(attributes: LogAttributes): Logger; 39 /** Shut down the underlying OTel LoggerProvider and release its resources. */ 40 shutdown(): Promise<void>; 41}