MCPcopy Index your code
hub / github.com/qawolf/cli / withLogging

Function withLogging

src/shell/platform/createTrpcClient.ts:41–57  ·  view source on GitHub ↗
(
    path: string,
    call: () => Promise<WireResult<T>>,
  )

Source from the content-addressed store, hash-verified

39 const { logger } = deps;
40
41 async function withLogging<T>(
42 path: string,
43 call: () => Promise<WireResult<T>>,
44 ): Promise<WireResult<T>> {
45 logger?.debug(`→ ${path}`);
46 const result = await call();
47 if (result.ok) {
48 logger?.debug(`← ${path} ok`);
49 } else {
50 const e = result.error;
51 const raw = e.kind === "http" ? e.body : e.cause.message;
52 const clipped = raw.length > 200 ? raw.slice(0, 200) + "…" : raw;
53 const msg = e.kind === "http" ? `${e.status} ${clipped}` : clipped;
54 logger?.warn(`← ${path} error (${e.kind}): ${msg}`);
55 }
56 return result;
57 }
58
59 return {
60 query: (path, input, schema) => {

Callers 1

createTrpcClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected