function traceMethodCall(obj) { const handler = { get(target, propKey, receiver) { const propValue = target[propKey]; // Get the original method return typeof propValue !== "function" ? propValue : function (...args) { const result = propValue.apply(this, args); console.log( `Call ${propKey} method -> ${JSON.stringify(result)}` ); return result; }; }, }; return new Proxy(obj, handler); }