craft-testkit: describe where formatting a log message stops at the byte limit

Formatting stops at the first write that would take the message past MAX_BYTES, so a message never passes the limit.
This commit is contained in:
dotCooCoo committed 2026-11-14 13:23:26 -08:00
1 parent 0d620e8a6d
commit fc7882fc96
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ The `log` feature adds `craft_testkit::log` and the `log` dependency. The module
A capture raises `log::max_level()` to the level it asks for and never lowers it. When the closure panics, the capture on that thread ends and the panic continues. Records from other threads do not appear in a per-thread capture.
A capture keeps at most `MAX_RECORDS` (4,096) records and `MAX_BYTES` (1 MiB) of message and target text. Formatting a message stops once it passes `MAX_BYTES`. A record over either limit is dropped and counted, and the capture returns `CaptureError::Overflow { dropped }` instead of a partial list. For `drain`, the limits apply to each interval between drains.
A capture keeps at most `MAX_RECORDS` (4,096) records and `MAX_BYTES` (1 MiB) of message and target text. Formatting a message stops at the first write that would take it past `MAX_BYTES`. A record over either limit is dropped and counted, and the capture returns `CaptureError::Overflow { dropped }` instead of a partial list. For `drain`, the limits apply to each interval between drains.
Run process-wide captures in a binary of their own, for example a `[[test]]` with `harness = false`:
+3 -3
View File
@@ -18,9 +18,9 @@
//! capture filters by its own level.
//!
//! A capture keeps at most [`MAX_RECORDS`] records and [`MAX_BYTES`] bytes of message and target
//! text. Formatting a message stops once it passes [`MAX_BYTES`]. A record over either limit is
//! dropped and counted, and the capture then returns [`CaptureError::Overflow`] with the number
//! dropped instead of a partial list.
//! text. Formatting a message stops at the first write that would take it past [`MAX_BYTES`]. A
//! record over either limit is dropped and counted, and the capture then returns
//! [`CaptureError::Overflow`] with the number dropped instead of a partial list.
use std::cell::RefCell;
use std::fmt;