/** * Python logging module for TypeScript - Browser version * * Provides a flexible event logging system. * FileHandler falls back to console output in browser environment. * * @see {@link https://docs.python.org/3/library/logging.html | Python logging documentation} * @module */ /** * Logging levels. */ declare const CRITICAL = 50; declare const FATAL = 50; declare const ERROR = 40; declare const WARNING = 30; declare const WARN = 30; declare const INFO = 20; declare const DEBUG = 10; declare const NOTSET = 0; /** * Map of level names to values. */ declare const levelNames: Record; /** * Get the level value from a level name. */ declare function getLevelName(level: number | string): string | number; /** * Log record containing information about a logging event. */ interface LogRecord { name: string; levelno: number; levelname: string; msg: string; args: unknown[]; created: number; filename?: string; lineno?: number; funcName?: string; exc_info?: Error; } /** * Handler base class for processing log records. */ declare abstract class Handler { level: number; formatter: Formatter | null; setLevel(level: number): void; setFormatter(formatter: Formatter): void; format(record: LogRecord): string; abstract emit(record: LogRecord): void; handle(record: LogRecord): void; } /** * Handler that writes to console. */ declare class StreamHandler extends Handler { emit(record: LogRecord): void; } /** * Handler that writes to a file. * Browser version: falls back to console output with filename prefix. */ declare class FileHandler extends Handler { private readonly filename; readonly mode: string; constructor(filename: string, mode?: string); emit(record: LogRecord): void; } /** * Formatter for log records. */ declare class Formatter { private readonly fmt; private readonly datefmt; constructor(fmt?: string, datefmt?: string); formatTime(record: LogRecord): string; format(record: LogRecord): string; } /** * Logger class for logging events. */ declare class Logger { readonly name: string; level: number; handlers: Handler[]; parent: Logger | null; propagate: boolean; constructor(name: string); setLevel(level: number): void; addHandler(handler: Handler): void; removeHandler(handler: Handler): void; getEffectiveLevel(): number; isEnabledFor(level: number): boolean; private makeRecord; private handle; log(level: number, msg: string, ...args: unknown[]): void; debug(msg: string, ...args: unknown[]): void; info(msg: string, ...args: unknown[]): void; warning(msg: string, ...args: unknown[]): void; warn(msg: string, ...args: unknown[]): void; error(msg: string, ...args: unknown[]): void; critical(msg: string, ...args: unknown[]): void; fatal(msg: string, ...args: unknown[]): void; exception(msg: string, ...args: unknown[]): void; } /** * Get a logger with the specified name. */ declare function getLogger(name?: string): Logger; /** * Configure the root logger. */ declare function basicConfig(options?: { level?: number; format?: string; datefmt?: string; filename?: string; filemode?: string; handlers?: Handler[]; }): void; declare function debug(msg: string, ...args: unknown[]): void; declare function info(msg: string, ...args: unknown[]): void; declare function warning(msg: string, ...args: unknown[]): void; declare function warn(msg: string, ...args: unknown[]): void; declare function error(msg: string, ...args: unknown[]): void; declare function critical(msg: string, ...args: unknown[]): void; declare function fatal(msg: string, ...args: unknown[]): void; declare function exception(msg: string, ...args: unknown[]): void; declare function log(level: number, msg: string, ...args: unknown[]): void; /** * Set the root logger level. */ declare function setLevel(level: number): void; /** * Disable all logging calls of level below the specified level. */ declare function disable(level?: number): void; /** * Shut down the logging system. */ declare function shutdown(): void; declare const loggingModule_CRITICAL: typeof CRITICAL; declare const loggingModule_DEBUG: typeof DEBUG; declare const loggingModule_ERROR: typeof ERROR; declare const loggingModule_FATAL: typeof FATAL; type loggingModule_FileHandler = FileHandler; declare const loggingModule_FileHandler: typeof FileHandler; type loggingModule_Formatter = Formatter; declare const loggingModule_Formatter: typeof Formatter; type loggingModule_Handler = Handler; declare const loggingModule_Handler: typeof Handler; declare const loggingModule_INFO: typeof INFO; type loggingModule_LogRecord = LogRecord; type loggingModule_Logger = Logger; declare const loggingModule_Logger: typeof Logger; declare const loggingModule_NOTSET: typeof NOTSET; type loggingModule_StreamHandler = StreamHandler; declare const loggingModule_StreamHandler: typeof StreamHandler; declare const loggingModule_WARN: typeof WARN; declare const loggingModule_WARNING: typeof WARNING; declare const loggingModule_basicConfig: typeof basicConfig; declare const loggingModule_critical: typeof critical; declare const loggingModule_debug: typeof debug; declare const loggingModule_disable: typeof disable; declare const loggingModule_error: typeof error; declare const loggingModule_exception: typeof exception; declare const loggingModule_fatal: typeof fatal; declare const loggingModule_getLevelName: typeof getLevelName; declare const loggingModule_getLogger: typeof getLogger; declare const loggingModule_info: typeof info; declare const loggingModule_levelNames: typeof levelNames; declare const loggingModule_log: typeof log; declare const loggingModule_setLevel: typeof setLevel; declare const loggingModule_shutdown: typeof shutdown; declare const loggingModule_warn: typeof warn; declare const loggingModule_warning: typeof warning; declare namespace loggingModule { export { loggingModule_CRITICAL as CRITICAL, loggingModule_DEBUG as DEBUG, loggingModule_ERROR as ERROR, loggingModule_FATAL as FATAL, loggingModule_FileHandler as FileHandler, loggingModule_Formatter as Formatter, loggingModule_Handler as Handler, loggingModule_INFO as INFO, type loggingModule_LogRecord as LogRecord, loggingModule_Logger as Logger, loggingModule_NOTSET as NOTSET, loggingModule_StreamHandler as StreamHandler, loggingModule_WARN as WARN, loggingModule_WARNING as WARNING, loggingModule_basicConfig as basicConfig, loggingModule_critical as critical, loggingModule_debug as debug, loggingModule_disable as disable, loggingModule_error as error, loggingModule_exception as exception, loggingModule_fatal as fatal, loggingModule_getLevelName as getLevelName, loggingModule_getLogger as getLogger, loggingModule_info as info, loggingModule_levelNames as levelNames, loggingModule_log as log, loggingModule_setLevel as setLevel, loggingModule_shutdown as shutdown, loggingModule_warn as warn, loggingModule_warning as warning }; } export { CRITICAL as C, DEBUG as D, ERROR as E, FATAL as F, Handler as H, INFO as I, type LogRecord as L, NOTSET as N, StreamHandler as S, WARN as W, FileHandler as a, Formatter as b, Logger as c, WARNING as d, basicConfig as e, critical as f, debug as g, disable as h, error as i, exception as j, fatal as k, loggingModule as l, getLevelName as m, getLogger as n, info as o, levelNames as p, log as q, shutdown as r, setLevel as s, warning as t, warn as w };