Developers
Logs SDK Reference
Server-side structured logging with @mydle/logs. Never put a logs token in browser code — use @mydle/browser-sdk for RUM.
Install
npm install @mydle/logs
import { createMydleLogger } from "@mydle/logs";
const logger = createMydleLogger({
apiKey: process.env.MYDLE_API_KEY!, // sk_live_…
service: "api",
environment: "production",
});API
- Levels:
debug / info / warn / error / fatal(plustrace/log). - Context fields: service, environment, release, traceId, spanId, requestId, sessionId, labels, metadata.
flush()/close()— drain and stop.
Optional OpenTelemetry context bridge attaches active traceId / spanId when @opentelemetry/api is present — IDs are never invented.
Batching
Bounded in-memory queue with periodic flush. Transient network / 5xx retries; auth and validation errors are not retried. Host code is not crashed by transport failures.
Ingest
Default endpoint POST /api/logs/v1/ingest. See API Reference and Logs SDK (product).
Limitations
- Requires log management entitlement (Pro+) for product search / retention.
- Not a browser SDK.