MCPcopy
hub / github.com/codedogQBY/ReadAny / formatLogArg

Function formatLogArg

packages/core/src/feedback/feedback-service.ts:131–143  ·  view source on GitHub ↗
(arg: unknown)

Source from the content-addressed store, hash-verified

129}
130
131function formatLogArg(arg: unknown): string {
132 if (arg instanceof Error) {
133 return `${arg.name}: ${arg.message}${arg.stack ? `\n${arg.stack}` : ""}`;
134 }
135 if (typeof arg === "string") return arg;
136 if (typeof arg === "number" || typeof arg === "boolean" || arg == null) return String(arg);
137
138 try {
139 return JSON.stringify(arg);
140 } catch {
141 return Object.prototype.toString.call(arg);
142 }
143}
144
145function formatErrorEvent(event: ErrorEvent): string {
146 if (event.error instanceof Error) {

Callers 6

formatErrorEventFunction · 0.85
appendStructuredLogFunction · 0.85
onUnhandledRejectionFunction · 0.85
submitFeedbackFunction · 0.85
refreshFeedbackStatusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected