diff --git a/docs/api/library-logger-to-logger.md b/docs/api/library-logger-to-logger.md index 88d3b82..25338e4 100644 --- a/docs/api/library-logger-to-logger.md +++ b/docs/api/library-logger-to-logger.md @@ -2,8 +2,8 @@ name: library-logger-to-logger group: api category: facade -update-time: 20260613 -description: Recover the underlying full sync logger from the library-facing sync facade without rebuilding sink or logger composition state. +update-time: 20260614 +description: Recover the underlying full sync logger from the library-facing sync facade without rebuilding, copying, or detaching the wrapped logger state. key-word: - logger - library @@ -35,9 +35,11 @@ Detailed rules explaining key parameters and behaviors - This conversion unwraps the existing logger instead of rebuilding it. - Sink wiring, target, min level, timestamp behavior, and attached wrappers remain the same. +- The returned `Logger[S]` is still that same live wrapped value, so later facade writes or later unwraps continue observing and mutating the same logger instance. - Use this when code needs full-surface APIs such as `with_timestamp(...)`, `with_filter(...)`, or `with_patch(...)`. - When the wrapped sink is `RuntimeSink`, unwrapping preserves that runtime sink value, but the result type is still `Logger[RuntimeSink]` rather than the `ConfiguredLogger` alias. Runtime-specific operations remain available through `full.sink` or by keeping a `ConfiguredLogger` value directly. - That same unwrap also preserves queued runtime state and file-backed helper behavior exactly as they existed behind the facade, including drain or flush results, file state snapshots, and file control methods. +- Runtime and file helper mutations are still live too. Draining queued records, flushing, or changing file helper state through the unwrapped logger changes the same runtime-backed logger that the facade already wrapped. ### How to Use @@ -63,6 +65,8 @@ ignore(full.sink.pending_count()) In this example, unwrapping preserves the same `RuntimeSink` pipeline, and callers reach runtime-specific helpers through that preserved sink value. +The same handle keeps reflecting later facade writes instead of becoming a detached snapshot. + ### Error Case e.g.: @@ -74,6 +78,8 @@ e.g.: - Recovering the full logger does not translate configured runtime state into a simpler snapshot; queued counts, file availability, file failure counters, and runtime file controls stay exactly as they were on the wrapped logger. +- Recovering the full logger also does not isolate later runtime-helper mutations. If unwrapped code drains queued records or changes file helper state, later facade writes still run against that same updated wrapped logger. + ### Notes 1. Use this only when the narrower facade is no longer sufficient.