SDK
SDK Configuration
Configure logger parameters including API keys, application names, and environments.
Configuration Options
| Option | Type | Required | Description |
|---|---|---|---|
| apikey | string | Yes | Your NotLogs API key starting with SEL_ |
| appName | string | Yes | Identifies your app or service in dashboards and alerts |
| enviorment | string | No | Environment name (“production”, “staging”, “development”) |
Basic Setup Example
lib/logger.ts
typescriptimport { createLogger } from "@notlogs/next";
export const logger = createLogger({
apikey: process.env.NOTLOGS_API_KEY!,
appName: "my-production-app",
enviorment: process.env.NODE_ENV || "production",
});Automatic Batching & Shutdown
The SDK automatically buffers log events in memory and flushes them in batches every 2 seconds or when the buffer reaches capacity. On process shutdown (SIGTERM / SIGINT), the SDK flushes all remaining events gracefully before exiting.