Created
August 27, 2025 15:27
-
-
Save rajvermacas/8aa34f541b167d3e73eba8cc8107c07b to your computer and use it in GitHub Desktop.
bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function(){ | |
| if (!window._capturingLogs) { | |
| window._capturingLogs = true; | |
| window._logs = []; | |
| const originalLog = console.log; | |
| console.log = function(...args) { | |
| window._logs.push(args.map(a => { | |
| try { return JSON.parse(JSON.stringify(a)); } catch(e) { return String(a); } | |
| })); | |
| originalLog.apply(console, args); | |
| }; | |
| alert('✅ Log capture started! Click the bookmark again to download logs.'); | |
| } else { | |
| const blob = new Blob([JSON.stringify(window._logs, null, 2)], { type: 'application/json' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = 'console-logs.json'; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| window._capturingLogs = false; | |
| alert('✅ Logs downloaded as console-logs.json'); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment