merge: resolve conflicts with master

This commit is contained in:
Claude
2026-01-20 02:38:37 +00:00
5 changed files with 19 additions and 33 deletions
+6 -22
View File
@@ -331,28 +331,12 @@ export class BaileysLogger implements ILogger {
...(typeof sanitizedObj === 'object' && sanitizedObj !== null ? sanitizedObj : { value: sanitizedObj }),
}
// Structured log (using type-safe method call)
switch (level) {
case 'trace':
this.structuredLogger.trace(enrichedObj, msg)
break
case 'debug':
this.structuredLogger.debug(enrichedObj, msg)
break
case 'info':
this.structuredLogger.info(enrichedObj, msg)
break
case 'warn':
this.structuredLogger.warn(enrichedObj, msg)
break
case 'error':
this.structuredLogger.error(enrichedObj, msg)
break
case 'fatal':
this.structuredLogger.fatal(enrichedObj, msg)
break
default:
this.structuredLogger.info(enrichedObj, msg)
// Structured log (skip if level is 'silent')
if (level !== 'silent') {
const logMethod = (this.structuredLogger as unknown as Record<string, ((obj: unknown, msg?: string) => void) | undefined>)[level]
if (logMethod) {
logMethod.call(this.structuredLogger, enrichedObj, msg)
}
}
// Event handler
+1 -1
View File
@@ -505,7 +505,7 @@ const globalCaches: Map<string, Cache<any>> = new Map()
export function getGlobalCache<V>(namespace: string, options?: CacheOptions<V>): Cache<V> {
if (!globalCaches.has(namespace)) {
globalCaches.set(namespace, new Cache<V>({ ...options, namespace }))
globalCaches.set(namespace, new Cache<V>({ ...options, namespace }) as Cache<V>)
}
return globalCaches.get(namespace) as Cache<V>
}
+3 -3
View File
@@ -120,7 +120,7 @@ export class LoggerAdapter implements ILogger {
}
if (this.config.levelMapping && level in this.config.levelMapping) {
return this.config.levelMapping[level] || 'info'
return this.config.levelMapping[level] ?? 'info'
}
return (level as LogLevel) || 'info'
@@ -328,8 +328,8 @@ function createLogMethod(
if (typeof logger[level] === 'function') {
;(logger[level] as (obj: unknown, msg?: string) => void)(obj, msg)
} else {
// Fallback to console
const consoleMethod = (console as unknown as Record<string, (...args: unknown[]) => void>)[level]
// Fallback to console methods
const consoleMethod = (console as unknown as Record<string, ((...args: unknown[]) => void) | undefined>)[level]
if (typeof consoleMethod === 'function') {
consoleMethod(obj, msg)
}
+6 -6
View File
@@ -566,7 +566,7 @@ export class Summary implements BaseMetric {
* Metrics registry
*/
export class MetricsRegistry {
private metrics: Map<string, Counter | Gauge | Histogram | Summary> = new Map()
private metricsMap: Map<string, Counter | Gauge | Histogram | Summary> = new Map()
private prefix: string
private defaultLabels: Labels
@@ -580,7 +580,7 @@ export class MetricsRegistry {
*/
register<T extends Counter | Gauge | Histogram | Summary>(metric: T): T {
const fullName = this.prefix ? `${this.prefix}_${metric.name}` : metric.name
this.metrics.set(fullName, metric)
this.metricsMap.set(fullName, metric)
return metric
}
@@ -589,7 +589,7 @@ export class MetricsRegistry {
*/
get(name: string): Counter | Gauge | Histogram | Summary | undefined {
const fullName = this.prefix ? `${this.prefix}_${name}` : name
return this.metrics.get(fullName)
return this.metricsMap.get(fullName)
}
/**
@@ -597,14 +597,14 @@ export class MetricsRegistry {
*/
remove(name: string): boolean {
const fullName = this.prefix ? `${this.prefix}_${name}` : name
return this.metrics.delete(fullName)
return this.metricsMap.delete(fullName)
}
/**
* Reset all metrics
*/
resetAll(): void {
for (const metric of this.metrics.values()) {
for (const metric of this.metricsMap.values()) {
metric.reset()
}
}
@@ -615,7 +615,7 @@ export class MetricsRegistry {
async getMetricsOutput(): Promise<string> {
const lines: string[] = []
for (const [name, metric] of this.metrics.entries()) {
for (const [name, metric] of this.metricsMap) {
lines.push(`# HELP ${name} ${metric.help}`)
lines.push(`# TYPE ${name} ${metric.type}`)
+3 -1
View File
@@ -559,7 +559,9 @@ export function extractTraceHeaders(headers: Record<string, string | undefined>)
options.baggage = {}
const pairs = baggageHeader.split(',')
for (const pair of pairs) {
const [key, value] = pair.split('=')
const parts = pair.split('=')
const key = parts[0]
const value = parts[1]
if (key && value) {
options.baggage[key.trim()] = decodeURIComponent(value.trim())
}