Usage
Send events, levels, optional fields, and client options with Oleq.Ai.Logs
Send events
await log.InfoAsync(new LogPayload { Message = "server started" });
await log.WarnAsync(new LogPayload { Message = "slow query", Body = new { ms = 420 } });
await log.ErrorAsync(new LogPayload
{
Message = "payment failed",
Kind = LogKind.Res,
Body = new { status = 402 },
});
await log.FlushAsync();
await log.DisposeAsync();Call FlushAsync() before shutdown. Dispose the client when the app stops.
Levels
Pass as type on the event, or call the matching method (log.info(…), log.error(…), …).
tracedebuginfosuccesswarnerrorfatalauditmetric
Optional fields
| Field | Notes |
|---|---|
Kind | Req or Res — separate events; dashboard shows REQ / RES badges |
Body | Any JSON-serializable attachment |
Track / Security / Metrics | Structured blobs on the event |
Options
| Option | Required | Default |
|---|---|---|
AppName | yes | — |
ApiKey | no* | OLEQLOG_API_KEY |
BaseUrl | no | production API |
Environment | no | DOTNET_ENVIRONMENT / ASPNETCORE_ENVIRONMENT or development |
FlushIntervalMs | no | 2000 |
MaxBatchSize | no | 50 |
Sensitive | no | optional field redact / strip before send |
*Required unless OLEQLOG_API_KEY is set.
Stack recipes: Examples