Skip to content

Error Capture

By default, auralog automatically captures uncaught exceptions and unhandled promise rejections. No extra code required — just call init().

In Node.js:

  • uncaughtException events
  • unhandledRejection events

In the browser:

  • error events on window
  • unhandledrejection events on window

Each captured error is sent as a fatal-level log with the error message and stack trace.

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);
}

Optionally intercept console.log, console.warn, and console.error:

init({
apiKey: "aura_...",
captureConsole: true,
});
Console methodauralog level
console.loginfo
console.warnwarn
console.errorerror

Console capture wraps the original methods — your console output still appears normally.