Log Ingestion
Send structured logs at five severity levels with arbitrary metadata.
Log ingestion sends structured log entries from your application to SeeStack. Logs are buffered in memory and flushed periodically — they are not sent synchronously on every call.
Basic Usage
SeeStack.captureLog('info', 'User signed in', {
userId: 'usr_1234',
method: 'oauth',
});
SeeStack.captureLog('error', 'Payment failed after 3 retries', {
orderId: 'ORD-5512',
amount: 99.90,
});seestack.capture_log("info", "User signed in", metadata={
"user_id": "usr_1234",
"method": "oauth",
})
seestack.capture_log("error", "Payment failed after 3 retries", metadata={
"order_id": "ORD-5512",
"amount": 99.90,
})seestack.CaptureLog("info", "User signed in", map[string]any{
"userID": "usr_1234",
"method": "oauth",
})
seestack.CaptureLog("error", "Payment failed after 3 retries", map[string]any{
"orderID": "ORD-5512",
"amount": 99.90,
})Severity Levels
| Level | Use Case |
|---|---|
debug | Verbose output for development and debugging |
info | Normal operational events (user actions, successful operations) |
warn | Something unexpected that is not yet an error |
error | A failure that needs investigation |
fatal | A critical failure that may crash the application |
Use warn (not warning) for log severity. The warning alias is only accepted in error tracking, not in logs.
Parameters
Prop
Type
Service and Trace Context
You can attach a service name and distributed trace ID to logs for correlation:
SeeStack.captureLog('warn', 'Payment retry attempt 3 of 5', {
service: 'payment-service',
traceId: 'trace-b9f2a1c3',
orderId: 'ORD-5512',
amount: 99.90,
currency: 'SAR',
});seestack.capture_log("warn", "Payment retry attempt 3 of 5", metadata={
"service": "payment-service",
"trace_id": "trace-b9f2a1c3",
"order_id": "ORD-5512",
"amount": 99.90,
"currency": "SAR",
})seestack.CaptureLog("warn", "Payment retry attempt 3 of 5", map[string]any{
"service": "payment-service",
"traceID": "trace-b9f2a1c3",
"orderID": "ORD-5512",
"amount": 99.90,
"currency": "SAR",
})Buffering Behavior
Logs are not sent immediately. They are held in an in-memory buffer (default: 500 items) and flushed:
- Every
flushIntervalMs(default: 5 seconds) - When the buffer reaches 80% capacity
- On explicit
flush()call - On application shutdown (best-effort)
Each log is sent as an individual request — there is no batch endpoint for logs.
Need to guarantee delivery before a process exits? Call SeeStack.flush() (or seestack.flush() / seestack.Flush()) and await its completion. See Buffering & Flushing for details.