fix(logger): address code review findings
- Remove misleading await from audit-logger tests (functions are sync) - Add cleanup() to LoggerAPI type definition in index.d.ts - Fix circular reference fallback to preserve null values Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,10 +61,13 @@ const consoleFormat = winston.format.combine(
|
||||
try {
|
||||
metaStr = ` ${JSON.stringify(meta, null, 2)}`
|
||||
} catch {
|
||||
// Fallback for circular references: stringify primitives, replace objects with placeholder
|
||||
// Fallback for circular references: stringify primitives, replace complex objects with placeholder
|
||||
metaStr = ` ${JSON.stringify(
|
||||
Object.fromEntries(
|
||||
Object.entries(meta).map(([k, v]) => [k, typeof v === 'object' ? '[Object]' : v])
|
||||
Object.entries(meta).map(([k, v]) => [
|
||||
k,
|
||||
v !== null && typeof v === 'object' ? `[Object]` : v
|
||||
])
|
||||
),
|
||||
null,
|
||||
2
|
||||
|
||||
1
src/preload/index.d.ts
vendored
1
src/preload/index.d.ts
vendored
@@ -130,6 +130,7 @@ export interface ConfigAPI {
|
||||
export interface LoggerAPI {
|
||||
log: (level: LogLevel, message: string, context?: Record<string, unknown>) => void
|
||||
fetchLevel: () => Promise<void>
|
||||
cleanup: () => void
|
||||
}
|
||||
|
||||
export interface UpdateAPI {
|
||||
|
||||
Reference in New Issue
Block a user