import { inspect } from "node:util" export function withLoggedMethodCalls(value: T) { return new Proxy(value as Record, { get(target, property) { const value = target[property] if (typeof value !== "function") { return value } return (...values: any[]) => { console.info( `${String(property)}(${values .map((value) => inspect(value, { depth: 1 })) .join(", ")})`, ) return value.apply(target, values) } }, }) as T }