SDK
Logging
Send structured events with level, message, and payload. Logs are sent immediately
Methods
The SDK exposes four methods. Level is determined by the method you call.
info()
Normal application events.
typescript
delok.info({ event: "user_login" });warn()
Potentially problematic conditions.
typescript
delok.warn({
event: "payment_retry",
message: "Payment gateway timeout",
});error()
Application errors.
typescript
delok.error({
event: "payment_failed",
message: "Payment failed",
});fatal()
Critical failures.
typescript
delok.fatal({
event: "database_crash",
message: "Primary DB unavailable",
});Event shape
- event — required, non-empty string
- message — optional string
- payload — optional structured JSON
- All methods return void
error() does not automatically capture JavaScript Error objects. Pass event and payload explicitly.
Error handling
The SDK sends logs fire-and-forget. Failures are swallowed internally (logged to self-monitoring); logging methods never reject.
If you need delivery guarantees, check the self-monitoring channel (DelokError events) rather than wrapping calls in try/catch.
- Configuration errors (invalid Delok constructor args) throw synchronously from new Delok()
- Event validation catches invalid input before the request is sent
- Delivery failures are swallowed internally and logged to self-monitoring DelokError
