console.error() and sends those events to Squasher with the current page URL, user agent, and any serialized console arguments.
Installation
- npm
- Script tag
Configuration
UseinitBrowserLogger() in a bundled app, or window.SquasherBrowserLogger.init() from the UMD build.
src/main.ts
The transport batches events every few seconds and attempts a final flush with
navigator.sendBeacon() when the page is hidden or unloaded.
Usage Example
src/main.ts
sdk.name = "@squasher/browser-logger"- The current page URL
- The browser user agent
- Serialized console arguments in
extra.console_arguments
Privacy/Security Considerations
- The browser logger captures every argument passed to
console.error(). Do not log secrets, access tokens, card data, or raw personal data in browser console calls. - The current page URL is attached to each event. Avoid placing sensitive values in query strings or route params if those pages initialize the logger.
- Initialize the logger only in environments where client-side error forwarding is expected, such as production or staging builds.
- Use HTTPS for the page and the ingest endpoint so the project key and payload are encrypted in transit.