(info: LogInfo, traced: TraceInfo, call?: CallInfo)
| 377 | return typeof valueToLog === 'string' ? removeUserPaths(valueToLog) : valueToLog; |
| 378 | } |
| 379 | function 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 | |
| 410 | function logResult(info: LogInfo, traced: TraceInfo, call?: CallInfo) { |
| 411 | const formatted = formatMessages(info, traced, call); |
no test coverage detected