MCPcopy Create free account
hub / github.com/agent-tower/core / formatErrorLogEntry

Function formatErrorLogEntry

packages/server/src/utils/error-log.ts:82–92  ·  view source on GitHub ↗
(entry: ErrorLogEntry, now = new Date())

Source from the content-addressed store, hash-verified

80}
81
82export function formatErrorLogEntry(entry: ErrorLogEntry, now = new Date()): string {
83 const error = normalizeError(entry.error);
84 return JSON.stringify({
85 time: now.toISOString(),
86 level: entry.level,
87 source: entry.source,
88 message: redactSensitiveText(entry.message),
89 ...(error ? { error } : {}),
90 ...(entry.metadata ? { metadata: sanitizeValue(entry.metadata) } : {}),
91 });
92}
93
94function normalizeError(error: unknown): Record<string, unknown> | null {
95 if (error == null) return null;

Callers 2

writeErrorLogFunction · 0.85
error-log.test.tsFile · 0.85

Calls 3

normalizeErrorFunction · 0.85
redactSensitiveTextFunction · 0.85
sanitizeValueFunction · 0.85

Tested by

no test coverage detected