import { SeverityNumber } from "@opentelemetry/api-logs"; /** Log severity levels in ascending order. */ export type LogLevel = "debug" | "info" | "warn" | "error" | "fatal"; /** Map from LogLevel to OTel SeverityNumber. */ export const SEVERITY_MAP: Record = { debug: SeverityNumber.DEBUG, info: SeverityNumber.INFO, warn: SeverityNumber.WARN, error: SeverityNumber.ERROR, fatal: SeverityNumber.FATAL, }; /** Attributes that can be attached to log records. */ export type LogAttributes = Record; /** Options for creating a logger. */ export interface CreateLoggerOptions { /** Service name (e.g., "atbb-appview"). */ service: string; /** Service version (e.g., "0.1.0"). */ version?: string; /** Deployment environment (e.g., "production", "development"). */ environment?: string; /** Minimum log level. Defaults to "info". */ level?: LogLevel; } /** Structured logger interface. */ export interface Logger { debug(message: string, attributes?: LogAttributes): void; info(message: string, attributes?: LogAttributes): void; warn(message: string, attributes?: LogAttributes): void; error(message: string, attributes?: LogAttributes): void; fatal(message: string, attributes?: LogAttributes): void; /** Create a child logger with additional base attributes. */ child(attributes: LogAttributes): Logger; /** Shut down the underlying OTel LoggerProvider and release its resources. */ shutdown(): Promise; }