pinqloq 2.0.8
See the version list below for details.
dotnet add package pinqloq --version 2.0.8
NuGet\Install-Package pinqloq -Version 2.0.8
<PackageReference Include="pinqloq" Version="2.0.8" />
<PackageVersion Include="pinqloq" Version="2.0.8" />
<PackageReference Include="pinqloq" />
paket add pinqloq --version 2.0.8
#r "nuget: pinqloq, 2.0.8"
#:package pinqloq@2.0.8
#addin nuget:?package=pinqloq&version=2.0.8
#tool nuget:?package=pinqloq&version=2.0.8
Pinqloq
Lightweight .NET SDK that buffers logs in-memory and ships them in batches to the Pinqloq ingest endpoint. No message broker, no token refresh — just an HTTPS endpoint and a secret key.
Installation
dotnet add package pinqloq
Quick Start
// Program.cs
builder.Services.AddPinqloq(options =>
{
options.SecretKey = "your-secret-key";
options.ApiLogsCollectionName = "myapp_api_logs"; // optional; short collection names are supported
});
app.UsePinqloqRequestLogging(); // auto-captures every HTTP request
// Exclude noisy paths (health checks, swagger, the SDK's own ingest endpoint):
app.UsePinqloqRequestLogging(options =>
{
options.ExcludePaths("/health", "/swagger", "/api/client-events");
});
The middleware also fills the Detail keys the log panel needs to render the request-detail view: RequestMethod, ResponseCode, InputJson (request body), and OutputJson (response body). Bodies are buffered and truncated at 32 KB.
Custom fields from HttpContext
Enrich each auto-captured log with your own fields resolved per request. Use AddMetadata for searchable/filterable dimensions (correlation id, user/tenant id) and AddDetail for heavier drill-down-only data. Selectors run after the request completes, so values set by auth/downstream middleware are available. A selector that returns null/empty — or throws — is silently skipped, and your keys never override the built-in ones. The one exception is event: it defaults to "{method} {path}" but you can override the title with AddMetadata("event", …).
app.UsePinqloqRequestLogging(options =>
{
// Searchable columns → Metadata
options.AddMetadata("userId", ctx => ctx.User.FindFirst("sub")?.Value);
options.AddMetadata("correlationId", ctx => ctx.Request.Headers["X-Correlation-Id"]);
// Detail-view-only data → Detail
options.AddDetail("userAgent", ctx => ctx.Request.Headers.UserAgent);
});
Note: adding a metadata key here makes it available for
MetadataEqualsfiltering, but showing it as a panel column may still require registering the key viaPOST /api/client-logs/metadata-keys.
Manual logging
Inject IPinqloqLogger wherever you need to emit logs. Event is required on every entry (see below):
public class OrderService(IPinqloqLogger logger)
{
public async Task CreateOrder(Order order)
{
// Fire-and-forget (buffered, batched -> /bulk)
logger.Enqueue(new PinqloqLogEntry
{
Event = "order.created", // required — shown as the title in the UI
LogLevel = PinqloqLogLevel.Information,
LogSourceType = PinqloqLogSourceType.Api,
Metadata = new() { ["orderId"] = order.Id.ToString() }
});
// Immediate + awaitable (-> /client-logs); returns a result, never throws for a rejected log
PinqloqSendResult result = await logger.SendAsync(new PinqloqLogEntry
{
Event = "order.payment_failed", // required
LogLevel = PinqloqLogLevel.Error,
LogSourceType = PinqloqLogSourceType.Api,
Metadata = new() { ["orderId"] = order.Id.ToString(), ["stage"] = "payment" }
});
if (!result.Success)
_logger.LogWarning("Pinqloq rejected the log: {Reason}", result.Error!.Reason);
}
}
Batch enqueue
If you already hold a collection of entries, hand them over in one call. Each is buffered and batched individually:
int queued = logger.Enqueue(entries); // returns how many were accepted into the buffer
Per-call callbacks
Both Enqueue and SendAsync accept optional onSent / onFailed callbacks. Because the buffered path sends in the background, these fire after Enqueue returns. onFailed receives a PinqloqLogError describing what went wrong. Callbacks that throw are swallowed and logged — the logging pipeline never crashes your app.
logger.Enqueue(
entry,
onSent: e => Console.WriteLine($"delivered: {e.Event}"),
onFailed: (e, err) => Console.WriteLine($"dropped {e.Event}: {err.Reason} — {err.Message}"));
Error handling
Failures surface through PinqloqLogError — via the onFailed callback on any method, and via PinqloqSendResult.Error from SendAsync. It carries:
| Member | Description |
|---|---|
Reason |
A PinqloqLogFailureReason category (see below) |
StatusCode |
The HTTP status code when the failure came from the server; null for non-HTTP failures |
Message |
Human-readable message (always populated) |
Exception |
The underlying exception when one exists (stack trace preserved); otherwise null |
PinqloqLogFailureReason values:
| Reason | Meaning |
|---|---|
Unauthorized |
HTTP 401 — secret key invalid or missing |
Forbidden |
HTTP 403 — secret key not authorized for the collection |
MissingCollection |
Reserved for older SDK behavior; current SDK lets the server resolve missing collection names |
QueueFull |
In-memory queue was full, so the log was dropped (only on the Enqueue path) |
HttpError |
Some other non-2xx HTTP response |
Timeout |
The request timed out |
Network |
Network error or unexpected exception |
Unknown |
Unclassified failure |
The Event field (required)
Every log must carry a non-empty Event. It is the human-readable title of the log and is what the Log Panel UI shows as the row title.
- The server injects it into the stored metadata as
metadata["event"]before persisting (an explicitEventoverrides any"event"you also put inMetadata). - If
Eventis empty/whitespace the log is rejected:SendAsyncreturns a result withSuccess == false(server400), and in a batch (/bulk) that single entry is silently skipped. UsePinqloqRequestLogging()sets it automatically to"{method} {path}"(e.g.GET /api/orders/42), so you never set it for auto-captured HTTP logs.
Timestamps (Date)
PinqloqLogEntry.Date is optional:
- Leave it unset and the SDK stamps it at enqueue time (
DateTimeOffset.UtcNow). This is important for buffered logs: a log keeps the time it actually happened, not the time the batch was later flushed. - Set it explicitly to backfill or forward a known event time. The server uses it as-is; only if it is omitted does the server fall back to its receive time.
How it works
UsePinqloqRequestLogging()captures every incoming HTTP request and callsEnqueueinternally. It auto-fillsEvent("{method} {path}") and the timestamp, so no per-request setup is needed.- Every log must have a non-empty
Event; entries without one are rejected (single) or skipped (batch). See TheEventfield. - A log's target is
entry.CollectionNameif set, otherwiseApiLogsCollectionName. If neither is set, the request is still sent and the server resolves the collection from the secret key's allowed collections when it can. - A background dispatcher drains the in-memory channel every 200 logs or 2 seconds (whichever comes first) and POSTs to
/api/client-logs/bulk. - Every request is authenticated via the
X-Secret-Keyheader — no JWT, no token refresh. - On graceful shutdown, remaining buffered logs are flushed before the process exits.
Public API
| Member | Purpose |
|---|---|
AddPinqloq(options => …) |
Registers the SDK (buffer, dispatcher, HTTP client) in DI |
UsePinqloqRequestLogging() |
Middleware that auto-captures every HTTP request |
IPinqloqLogger.Enqueue(entry, onSent?, onFailed?) |
Buffered, fire-and-forget logging (batched → /bulk). Returns bool — false if the queue was full |
IPinqloqLogger.Enqueue(entries, onSent?, onFailed?) |
Buffered batch enqueue. Returns the count accepted into the buffer |
IPinqloqLogger.SendAsync(entry, onSent?, onFailed?, ct?) |
Immediate, awaitable logging (→ /client-logs). Returns PinqloqSendResult |
All logging methods accept optional onSent / onFailed callbacks; onFailed receives a PinqloqLogError. See Per-call callbacks.
Options
| Property | Default | Description |
|---|---|---|
SecretKey |
(required) | API secret key |
ApiLogsCollectionName |
null |
Optional target collection for UsePinqloqRequestLogging and fallback for entries without a CollectionName. Short names such as myapp_api_logs are accepted when the secret key allows myapp_api_logs_{projectId}. |
BulkPath |
api/client-logs/bulk |
Path of the batched ingest endpoint |
SinglePath |
api/client-logs |
Path of the single (immediate) ingest endpoint |
BatchSize |
200 |
Max logs per HTTP request |
FlushInterval |
00:00:02 |
Max wait before flushing |
QueueCapacity |
10000 |
In-memory channel capacity |
HttpTimeout |
00:00:10 |
HTTP request timeout |
AppVersionName |
null |
Optional app version tag written by UsePinqloqRequestLogging. Only used for auto-captured HTTP logs; safe to leave unset. |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on pinqloq:
| Package | Downloads |
|---|---|
|
Pinqponq.Observability
Pinqloq logging for ASP.NET Core: one structured record per request (redacted request/response bodies, route-based event names, error detail from Pinqponq.ErrorHandling), and an ILogService for application and job logs with stack trace trimming. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.3.2 | 403 | 9/14/2026 |
| 4.3.1 | 132 | 9/9/2026 |
| 4.3.0 | 1,838 | 9/8/2026 |
| 4.2.0 | 559 | 9/1/2026 |
| 4.1.0 | 234 | 8/25/2026 |
| 4.0.3 | 266 | 8/6/2026 |
| 4.0.2 | 352 | 7/22/2026 |
| 4.0.1 | 138 | 7/21/2026 |
| 4.0.0 | 133 | 7/20/2026 |
| 3.0.0 | 140 | 7/14/2026 |
| 2.0.8 | 168 | 7/14/2026 |
| 2.0.7 | 291 | 7/6/2026 |
| 2.0.6 | 126 | 7/6/2026 |
| 2.0.5 | 197 | 7/6/2026 |
| 2.0.4 | 138 | 7/6/2026 |
| 2.0.3 | 188 | 7/2/2026 |
| 2.0.2 | 137 | 7/2/2026 |
| 2.0.1 | 148 | 7/1/2026 |
| 2.0.0 | 222 | 6/23/2026 |
| 1.0.2 | 142 | 6/19/2026 |
2.0.8: Request-logging middleware now carries the log title in metadata["event"] (was detail["event"]); override it with AddMetadata("event", ...). The panel reads the title from metadata["event"], so titles now render for auto-captured logs.