fix(utils): resolve TypeScript compilation errors
- baileys-event-stream.ts: Add null check for buffer item in priority insertion - baileys-logger.ts: Handle 'silent' log level and fix JID sanitization - cache-utils.ts: Fix type incompatibility in global cache with any type - logger-adapter.ts: Add nullish coalescing for level mapping and fix console type cast - prometheus-metrics.ts: Rename private 'metrics' property to 'metricsMap' to avoid conflict with method - trace-context.ts: Store baggage header in variable before accessing to fix undefined check
This commit is contained in:
@@ -120,7 +120,7 @@ export class LoggerAdapter implements ILogger {
|
||||
}
|
||||
|
||||
if (this.config.levelMapping && level in this.config.levelMapping) {
|
||||
return this.config.levelMapping[level]
|
||||
return this.config.levelMapping[level] ?? 'info'
|
||||
}
|
||||
|
||||
return (level as LogLevel) || 'info'
|
||||
@@ -327,8 +327,12 @@ function createLogMethod(
|
||||
return (obj: unknown, msg?: string) => {
|
||||
if (typeof logger[level] === 'function') {
|
||||
;(logger[level] as (obj: unknown, msg?: string) => void)(obj, msg)
|
||||
} else if (typeof (console as Record<string, unknown>)[level] === 'function') {
|
||||
;(console as Record<string, (...args: unknown[]) => void>)[level](obj, msg)
|
||||
} else {
|
||||
// Fallback to console methods
|
||||
const consoleMethod = (console as unknown as Record<string, ((...args: unknown[]) => void) | undefined>)[level]
|
||||
if (typeof consoleMethod === 'function') {
|
||||
consoleMethod(obj, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user