Loading homepage
Capture the arguments of log calls while preserving normal logging, and provide a way to restore the original logger.
Input: const capture = captureConsoleLog(); try { console.log("Ready", 3); } finally { capture.restore(); } capture.history Output: [["Ready", 3]]
Input: const target = { log() {} }; const capture = captureConsoleLog(target); target.log(); capture.restore(); capture.history Output: [[]]
Implement the exported function in index.js or index.ts. See requirements for edge cases.