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,});Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your project API key. Starts with aura_. Find it in your project settings. |
environment | string | undefined | Environment label attached to every log (e.g. "production", "staging"). |
captureConsole | boolean | false | When true, intercepts console.log, console.warn, and console.error and sends them as auralog logs. |
captureErrors | boolean | true | Automatically captures uncaught exceptions and unhandled promise rejections. |
flushInterval | number | 5000 | How often (in milliseconds) batched logs are sent to the ingest endpoint. |
endpoint | string | "https://ingest.auralog.ai" | Custom ingest endpoint URL. Only change this if you’re self-hosting. |
Return value
Section titled “Return value”init() returns an object with a flush method:
const { flush } = init({ apiKey: "aura_..." });
// Force-send all buffered logsawait flush();Shutdown
Section titled “Shutdown”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.