RingBufferSink
Keeps the last capacity records in memory, so they can be gathered on demand: attached to a bug report, shown in a debug screen, or returned by a diagnostics endpoint.
Writing is lock free and never blocks the logging thread. When full, the oldest record is replaced.
val recent = RingBufferSink(capacity = 2_000)
KcoapLogging.configure { level = LogLevel.DEBUG; sink = ConsoleSink() + recent }
...
report.attach(recent.dump())Content copied to clipboard