Skip to content

Configuration

Pass a configuration object to init():

import { init } from "auralog-sdk";
init({
apiKey: "aura_your_api_key",
environment: "production",
captureConsole: false,
captureErrors: true,
flushInterval: 5000,
});
OptionTypeDefaultDescription
apiKeystringrequiredYour project API key. Starts with aura_. Find it in your project settings.
environmentstringundefinedEnvironment label attached to every log (e.g. "production", "staging").
captureConsolebooleanfalseWhen true, intercepts console.log, console.warn, and console.error and sends them as auralog logs.
captureErrorsbooleantrueAutomatically captures uncaught exceptions and unhandled promise rejections.
flushIntervalnumber5000How often (in milliseconds) batched logs are sent to the ingest endpoint.
endpointstring"https://ingest.auralog.ai"Custom ingest endpoint URL. Only change this if you’re self-hosting.

init() returns an object with a flush method:

const { flush } = init({ apiKey: "aura_..." });
// Force-send all buffered logs
await flush();

Call shutdown() to flush remaining logs and clean up event listeners:

import { shutdown } from "auralog-sdk";
await shutdown();

This is important in serverless environments where the process may exit before the flush interval fires. See Environments for platform-specific guidance.