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

Function formatMessages

src/platform/logging/index.ts:379–408  ·  view source on GitHub ↗
(info: LogInfo, traced: TraceInfo, call?: CallInfo)

Source from the content-addressed store, hash-verified

377 return typeof valueToLog === 'string' ? removeUserPaths(valueToLog) : valueToLog;
378}
379function formatMessages(info: LogInfo, traced: TraceInfo, call?: CallInfo): string {
380 call = normalizeCall(call!);
381 ``;
382 const messages = [info.message];
383 messages.push(`${call.kind} name = ${call.name}`.trim());
384 if (traced) {
385 messages.push(`completed in ${traced.elapsed}ms`);
386 messages.push(`has a ${traced.returnValue ? 'truthy' : 'falsy'} return value`);
387 } else {
388 messages[messages.length - 1] = `${messages[messages.length - 1]} (started execution)`;
389 }
390 if ((info.opts & TraceOptions.Arguments) === TraceOptions.Arguments) {
391 if (info.level === LogLevel.Debug) {
392 // This is slower, hence do this only when user enables trace logging.
393 messages.push(
394 argsToLogString(
395 call.args.map((arg, index) =>
396 call ? formatArgument(call.target, call.methodName, arg, index) : arg
397 )
398 )
399 );
400 } else {
401 messages.push(argsToLogString(call.args));
402 }
403 }
404 if (traced && (info.opts & TraceOptions.ReturnValue) === TraceOptions.ReturnValue) {
405 messages.push(returnValueToLogString(traced.returnValue));
406 }
407 return messages.join(', ');
408}
409
410function logResult(info: LogInfo, traced: TraceInfo, call?: CallInfo) {
411 const formatted = formatMessages(info, traced, call);

Callers 1

logResultFunction · 0.85

Calls 7

argsToLogStringFunction · 0.90
returnValueToLogStringFunction · 0.90
normalizeCallFunction · 0.85
formatArgumentFunction · 0.85
mapMethod · 0.80
joinMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected