-
Notifications
You must be signed in to change notification settings - Fork 3
Recent History Capture
Recent-history capture means keeping the last N formatted log records in memory and dumping them only when they become useful, for example after an error or failed request.
This is similar in purpose to “backtrace logging” in some other logging libraries, but it is not a stack trace. It does not capture call stacks. It captures recent log records.
logme implements this storage primitive through RingBufferBackend.
RingBufferBackend keeps only the last configured number of formatted records. Old records are removed automatically when the limit is reached.
Example JSON backend configuration:
{
"type": "RingBufferBackend",
"max-items": 200
}Example runtime command:
logmectl -p 9010 backend --channel net --add ring --max-items 200The backend can later join its current records into a single string through the C++ API.
Use recent-history capture when full verbose logging would be too noisy or too expensive to persist permanently, but the last few records would be valuable when a failure happens.
Typical scenarios:
- request diagnostics
- connection lifecycle diagnostics
- unit tests that assert on emitted logs
- temporary in-memory diagnostics for
logmewebor application-owned tools - storing the last few steps before an error without keeping the entire debug stream
BufferBackend stores a continuous text buffer. Depending on policy, it can stop appending or delete oldest lines when it reaches a byte limit.
RingBufferBackend stores a fixed number of records. It is better for “last N events” diagnostics.
Whether a record reaches RingBufferBackend is still controlled by the channel. If the channel rejects Debug records by level, the ring buffer will not see those records.
For independent per-destination levels, use separate channels and routing. logme currently treats the channel as the primary policy unit rather than adding hidden per-backend level checks.
See Feature Map and Routing.
logme — flexible runtime logging system
Home · Getting Started · Architecture · Output · Backends · Configuration
GitHub: https://github.com/efmsoft/logme
- Home
- Getting Started
- Why logme?
- Core Concepts
- Logging Macros
- Fatal Handling
- Crash Logging
- glog Compatibility
- C API
- Choosing Logging Macros
- Function tracing
- Trace Points
- Override Scopes
- Advanced Features
- Collapse Logging
- Feature Map
- Overview
- Console Backend
- Debugger Backend
- File Backend
- File Rotation & Retention
- Buffer Backend
- Ring Buffer Backend
- SharedFile Backend
- Callback Backend
- Windows Event Log Backend
- Custom Backends
- Runtime Control
- Configuration
- Configuration JSON
- Control Server
- Environment Control
- Control Policies
- Trace Points
- Message Filtering