Skip to main content

set_sink

Function set_sink 

Source
pub fn set_sink(sink: PlatformSink) -> Result<(), PlatformSink>
Expand description

Chooses the sink the engine writes to, in place of PlatformSink::native (which prefers journald on Linux and os_log on macOS, and stdout only when RLG_FALLBACK_STDOUT or GITHUB_ACTIONS is set).

The background flusher picks its sink once, when the first record (or any other use of ENGINE) starts it, so call this first, for example at the top of main. No environment variable is involved, so it is safe once threads are running.

use rlg::engine::set_sink;
use rlg::sink::PlatformSink;

set_sink(PlatformSink::Stdout).expect("set before the first record");

ยงErrors

Hands sink back when the flusher has already chosen its sink.