📝 clarify sync timestamp derivation

This commit is contained in:
Nanaloveyuki
2026-06-14 11:55:55 +08:00
parent 5514009abe
commit 8fb9beb008
+6
View File
@@ -37,6 +37,8 @@ Detailed rules explaining key parameters and behaviors
- When enabled, `log(...)` captures `@env.now()` and stores it in the record.
- When disabled, emitted records use `0UL` as the timestamp value.
- This setting affects later emitted records only.
- The returned logger is derived from `self`; the original logger value is not mutated.
- Only the stored `timestamp` flag changes. Target, minimum level, and sink behavior stay on the same `Logger[S]` surface.
- Formatter or sink behavior stays unchanged; they just receive records with or without real timestamps.
### How to Use
@@ -53,6 +55,8 @@ let logger = Logger::new(console_sink())
In this example, each emitted record captures current time automatically.
The returned logger still uses the same ordinary synchronous logging calls; only record timestamp capture changes.
#### When Need Deterministic Or Minimal Records
When timestamps should be disabled for tests or reduced output:
@@ -76,3 +80,5 @@ e.g.:
2. It works well together with text formatters that optionally show timestamps.
3. Use a derived logger value when one path should capture timestamps and another should keep the original deterministic record shape.