Skip to main content

Module log

Module log 

Expand description

Logs: the workflow’s (Ctx::log) and the engine’s own warnings, through one hook.

By default a record is one line on stderr: text, or JSON with FUSEE_LOG_FORMAT=json. FUSEE_LOG=debug shows debug records too. set_hook sends records elsewhere, for example to tracing:

ⓘ
fusee::log::set_hook(|r| {
    let (id, step) = (r.workflow_id.unwrap_or(""), r.step.unwrap_or(""));
    match r.level {
        fusee::log::Level::Error => tracing::error!(workflow_id = id, step, "{}", r.message),
        fusee::log::Level::Warn => tracing::warn!(workflow_id = id, step, "{}", r.message),
        fusee::log::Level::Info => tracing::info!(workflow_id = id, step, "{}", r.message),
        fusee::log::Level::Debug => tracing::debug!(workflow_id = id, step, "{}", r.message),
    }
});

A workflow’s logs are silent while its run replays the journal, so a line is written once however often the code runs; they are not journaled.

Structs§

Record
One log record.

Enums§

Level
How much a record matters.

Functions§

emit
Writes a record through the hook.
reset_hook
Back to the default: stderr.
set_hook
Sends every record to f instead of stderr (process-wide).
text
The text form: fusee: <message> for the engine; for a workflow, the level, the run and step, then the message.