Skip to contents

Registers an additional output destination. Every logged event fans out to the console sink (always on) and every registered file sink, so console, text-file, and NDJSON outputs can all run simultaneously (design doc section 6).

Usage

logtree_sink_file(path, format = c("text", "json"))

Arguments

path

File path to append rendered log lines to.

format

"text" for a plain ASCII tree (no ANSI, independent of the active console theme) or "json" for one NDJSON object per event.

Value

NULL, invisibly.

Examples

logtree_reset()
logtree_sink_file(tempfile(), format = "text")
with_logging({
  log_step("Step one")
})
#>  Step one
#>  Run complete in 0.00s
#> └─  Done  0.00s