@squasher-ai/browser-logger sends each console.error call in the browser to Squasher. It does
nothing else: it does not capture uncaught errors, Web Vitals, or session replays. For those, use
the Browser SDK. This page is tested with version 0.4.0.
Install the logger
- npm
- Script tag
Start the logger
Start the logger once, when the page loads.- npm
- Script tag
src/main.ts
console.error call still writes to the console, and it also goes to Squasher.
What each event contains
- The message
Checkout failed Card declined {"cartId":"cart_123"}: all arguments, joined with spaces. - The error type and the stack trace of the first
Errorargument. - The page URL and the browser user agent.
- All arguments, as JSON, in the
console_argumentsextra field.
Send a test error
Run this in the browser console of your running site, or from a button handler:Options
init returns the logger. flush() sends the queued events now, and close() sends them and
restores the original console.error.
Limits
- The logger has no
environmentorreleaseoption, so its events have no environment. Automatic AI triage runs only onproductionissues. To triage one of these issues, select Run triage in the Squasher triage card on the issue page. initthrows whenapiKeyorprojectIdis empty, and when you call it a second time.- When a send fails, the logger keeps the events and tries again at the next send.
- Stack traces from a minified bundle point at the minified files. Upload source maps for the release so the issue page shows the original files.
Next steps
Browser SDK
Capture uncaught errors, Web Vitals, and session replays.
Troubleshooting
Find out why an event does not appear.