Skip to main content

Module log_sink

Module log_sink 

Source
Expand description

Log sink for in-process output routing.

The LogSink struct implements std::io::Write and forwards output to TerminalWriter::write_log, ensuring that:

  1. Output is line-buffered (to prevent torn lines).
  2. Content is sanitized (escape sequences stripped) by default.
  3. The One-Writer Rule is respected.

§Usage

use ftui_runtime::log_sink::LogSink;
use std::io::Write;

// Assuming you have a mutable reference to TerminalWriter
let mut sink = LogSink::new(&mut terminal_writer);

// Now you can use it with any std::io::Write consumer
writeln!(sink, "This log message is safe: \x1b[31mcolors stripped\x1b[0m").unwrap();

Structs§

LogSink
A write adapter that routes output to the terminal’s log scrollback.