Error Capture
By default, auralogs automatically captures uncaught exceptions and unhandled promise rejections. No extra code required — just call init().
What’s captured
Section titled “What’s captured”In Node.js:
uncaughtExceptioneventsunhandledRejectionevents
In the browser:
errorevents onwindowunhandledrejectionevents onwindow
Each captured error is sent as a fatal-level log with the error message and stack trace. If you’ve configured globalMetadata, captured errors carry it too — so an uncaught exception lands in the dashboard already attributed to the current user, build, or whatever else you’ve set up.
Disabling automatic capture
Section titled “Disabling automatic capture”If you prefer to handle errors yourself:
init({ apiKey: "aura_...", captureErrors: false,});Then log errors manually:
try { await riskyOperation();} catch (err) { auralog.error(err.message, { operation: "riskyOperation" }, err.stack);}Console capture
Section titled “Console capture”Optionally intercept console.log, console.warn, and console.error:
init({ apiKey: "aura_...", captureConsole: true,});| Console method | auralogs level |
|---|---|
console.log | info |
console.warn | warn |
console.error | error |
Console capture wraps the original methods — your console output still appears normally.
Captured console.* calls also carry globalMetadata if it’s configured. This is the typical way to attribute every console-captured log to a current user without rewriting any of your existing console.log call sites.