Skip to contents

Steps

The nodes of the tree. log_step() closes itself when the function that opened it returns; log_open()/log_close() are the manual pair for code with no function frame to close on.

log_step()
Open a logged step
log_open()
Open a step under manual lifetime control
log_close()
Close a manually-opened step

Leaf lines

Status-tagged messages logged under the current step. log_warn() and log_error() also elevate the enclosing step’s own glyph.

log_info()
Log an informational leaf line
log_success()
Log a success leaf line
log_warn()
Log a warning leaf line
log_error()
Log an error leaf line
log_debug()
Log a debug leaf line

Running a job

Wrap a run so an uncaught error marks every open step before the stack unwinds – and, optionally, so R’s own warnings and messages land in the tree instead of on stderr.

with_logging()
Run an expression with top-level error handling and a run summary

The run digest

What went wrong, without scrolling back through the tree.

logtree_summary()
Report a digest of notable events

Appearance

Glyphs, colors, connectors, and the optional elapsed, call-site and timestamp columns – five presets, every slot overridable.

logtree_theme()
Set the active glyph/color theme

Output sinks

Every event fans out to every registered sink. The console sink is always on; add files, buffers, or a function of your own.

logtree_sink_file()
Add a file sink
logtree_sink()
Register a sink of your own
logtree_sinks()
List the registered sinks
logtree_sink_remove()
Remove registered sinks
logtree_sink_memory()
Collect logged events in memory
logtree_sink_memory_events()
Read a memory sink's collected events

Verbosity and silence

How much gets rendered, and how to turn it all off without unregistering anything.

logtree_threshold()
Set the minimum log level threshold to render
logtree_mute() logtree_unmute()
Silence logtree's output

State

Clear the stack, the digest, and the run id.

logtree_reset()
Reset internal logtree state

logger package integration

Route an existing logger codebase through logtree without rewriting the call sites.

logtree_logger()
Route the logger package through logtree
layout_logtree()
A logger layout that renders through logtree

Package

logtree logtree-package
logtree: Tree-Style Console Logger for Nested Processes