Skip to content

Logging

After calling init(), use the auralog object to send logs:

import { auralog } from "auralog-sdk";
auralog.debug("Cache miss for user profile", { userId: "usr_123" });
auralog.info("Order placed", { orderId: "ord_456", total: 99.99 });
auralog.warn("Rate limit approaching", { current: 950, limit: 1000 });
auralog.error("Payment failed", { userId: "usr_123", error: "card_declined" });
auralog.fatal("Database connection lost", { host: "db-primary" });
LevelSeverityBehavior
debug0Batched. Useful for development tracing.
info1Batched. General operational events.
warn2Batched. Something unexpected but not broken.
error3Sent immediately. Triggers AI analysis.
fatal4Sent immediately. Triggers AI analysis.

Logs at error and fatal level bypass the batch queue and are sent to the ingest endpoint immediately.

The second argument is an optional metadata object. Use it to attach structured context:

auralog.error("Checkout failed", {
userId: "usr_123",
cartId: "cart_789",
paymentMethod: "stripe",
errorCode: "card_declined",
});

Metadata values can be strings, numbers, booleans, or nested objects. They appear in the dashboard log viewer and are included in AI analysis context.

error and fatal accept an optional third argument for a stack trace:

try {
await processOrder(order);
} catch (err) {
auralog.error("Order processing failed", { orderId: order.id }, err.stack);
}

If you’re using automatic error capture (enabled by default), stack traces are captured automatically for uncaught exceptions. See Error Capture.