Error Capture
By default, auralog 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.
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 | auralog level |
|---|---|
console.log | info |
console.warn | warn |
console.error | error |
Console capture wraps the original methods — your console output still appears normally.