Skip to main content

LogSink

Trait LogSink 

Source
pub trait LogSink: Send + Sync {
    // Required methods
    fn enabled(&self, level: LogLevel) -> bool;
    fn log(&self, record: &LogRecord<'_>);
}
Expand description

Where the log lines of a build, or of any other work, go.

A host gives a sink when it starts a Sheet, and the work writes to it through Scope::log. The trait stands on its own: a host may give the same sink to code that runs outside any build.

A log line is text for a person about what the work does; a problem of the document is a diagnostic, never a log line.

The sink is called on the thread that writes the line, possibly from several threads at once, and holds that work up until it returns.

Required Methods§

Source

fn enabled(&self, level: LogLevel) -> bool

Whether the sink wants the lines of level. A writer calls it before building the text of a line, to skip building a text nobody wants. A sink may still receive a record of a level it does not want, and then ignores it.

Source

fn log(&self, record: &LogRecord<'_>)

Receives one line.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§