@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
1 lines • 4.46 kB
Source Map (JSON)
{"version":3,"file":"logger.mjs","sources":["../../../src/types/logger.ts"],"sourcesContent":["/**\n * Log levels in ascending order of severity.\n *\n * Levels allow filtering messages: when a specific level is set,\n * messages of that level and all higher levels will be logged.\n */\nexport enum LogLevel {\n /**\n * Detailed debug information for developers.\n * Default level in development environment.\n */\n DEBUG = 0,\n\n /**\n * Informational messages about normal application operation.\n * Used for tracking business logic.\n */\n INFO = 1,\n\n /**\n * Important but non-critical events.\n * Examples: successful request processing, configuration changes.\n */\n NOTICE = 2,\n\n /**\n * Warnings about potential problems.\n * Application continues to run but attention is required.\n */\n WARNING = 3,\n\n /**\n * Runtime errors requiring intervention.\n * Some functionality is unavailable but the application is running.\n */\n ERROR = 4,\n\n /**\n * Critical errors disrupting component operation.\n * Require immediate intervention during working hours.\n */\n CRITICAL = 5,\n\n /**\n * Serious problems requiring immediate resolution.\n * Examples: database unavailable, disk space exhausted.\n */\n ALERT = 6,\n\n /**\n * System is unusable, requires urgent intervention.\n * Highest severity level.\n */\n EMERGENCY = 7\n}\n\nexport type LogLevelName = keyof typeof LogLevel\n\nexport interface LogRecord {\n channel: string\n level: LogLevel\n levelName: LogLevelName\n message: string\n context: Record<string, any>\n extra: Record<string, any>\n timestamp: Date\n}\n\nexport interface Formatter {\n format(record: LogRecord): any\n}\n\nexport interface HandlerOptions {\n bubble?: boolean\n [key: string]: any\n}\n\nexport interface Handler {\n /**\n * Handles a log record.\n *\n * @param {LogRecord} record - Log record to handle.\n * @returns {boolean}\n */\n handle(record: LogRecord): Promise<boolean>\n isHandling(level: LogLevel): boolean\n shouldBubble(): boolean\n setFormatter(formatter: Formatter): void\n getFormatter(): Formatter | null\n}\n\nexport type Processor = (record: LogRecord) => LogRecord\n\nexport interface LoggerInterface {\n /**\n * Logs with an arbitrary level.\n */\n log(level: LogLevel, message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Detailed debug information.\n */\n debug(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Interesting events.\n *\n * Example: User logs in, SQL logs.\n */\n info(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Normal but significant events.\n */\n notice(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Exceptional occurrences that are not errors.\n *\n * Example: Use of deprecated APIs, poor use of an API, undesirable things\n * that are not necessarily wrong.\n */\n warning(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Runtime errors that do not require immediate action but should typically\n * be logged and monitored.\n */\n error(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Critical conditions\n *\n * Example: Application component unavailable, unexpected exception\n */\n critical(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * Action must be taken immediately.\n *\n * Example: Entire website down, database unavailable, etc. This should\n * trigger the SMS alerts and wake you up.\n */\n alert(message: string, context?: Record<string, any>): Promise<void>\n\n /**\n * System is unusable.\n */\n emergency(message: string, context?: Record<string, any>): Promise<void>\n}\n"],"names":["LogLevel"],"mappings":";;;;;;;;AAMO,IAAK,QAAA,qBAAAA,SAAAA,KAAL;AAKL,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,WAAQ,CAAA,CAAA,GAAR,OAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,aAAU,CAAA,CAAA,GAAV,SAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,WAAQ,CAAA,CAAA,GAAR,OAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,cAAW,CAAA,CAAA,GAAX,UAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,WAAQ,CAAA,CAAA,GAAR,OAAA;AAMA,EAAAA,SAAAA,CAAAA,SAAAA,CAAA,eAAY,CAAA,CAAA,GAAZ,WAAA;AA/CU,EAAA,OAAAA,SAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA;;;;"}