MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / valueToLogString

Function valueToLogString

src/platform/logging/util.ts:7–27  ·  view source on GitHub ↗
(value: unknown, kind: string)

Source from the content-addressed store, hash-verified

5export type Arguments = any[];
6
7function valueToLogString(value: unknown, kind: string): string {
8 if (Array.isArray(value)) {
9 return value.map((item) => valueToLogString(item, kind)).join(', ');
10 }
11 if (value === undefined) {
12 return 'undefined';
13 }
14 if (value === null) {
15 return 'null';
16 }
17 try {
18 // eslint-disable-next-line @typescript-eslint/no-explicit-any
19 if (value && (value as any).path) {
20 // eslint-disable-next-line @typescript-eslint/no-explicit-any
21 return `<Uri:${(value as any).path}>`;
22 }
23 return JSON.stringify(value);
24 } catch {
25 return `<${kind} cannot be serialized for logging>`;
26 }
27}
28
29// Convert the given array of values (func call arguments) into a string
30// suitable to be used in a log message.

Callers 2

argsToLogStringFunction · 0.85
returnValueToLogStringFunction · 0.85

Calls 2

joinMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected