Skip to contents

Prints a compact end-of-run digest of everything worth attention that happened since the last logtree_reset(): every warning and error leaf line, plus any step that closed with a warning, error, or interrupted status. Each entry shows the status glyph, the breadcrumb path to where it happened, and the message (for leaf lines) or an outcome word (for steps).

Usage

logtree_summary(filter = NULL, depth = NULL)

Arguments

filter

Optional character vector of statuses to include, e.g. "error" or c("warning", "interrupted"). Only entries whose status matches are printed and returned; recognised statuses are "error", "warning", "interrupted", and the pinned leaf statuses "info", "success", "debug". NULL (the default) reports every entry.

depth

Optional positive integer limiting how many trailing (deepest) breadcrumb nodes are printed. The message counts as the terminal node, so depth = 1 prints just the message (or, for a step entry, its innermost step), depth = 2 the message plus its immediate parent, and so on. NULL (the default) prints the full breadcrumb. Affects printing only; the returned entries always carry the full path.

Value

The recorded entries, invisibly: a list of records, each a list with kind, status, msg, path (character vector), and elapsed.

Details

Unlike scrolling the live tree, the digest surfaces breakage even when no with_logging() handler was installed – interrupted steps are picked up from their close lines. Ordinary info / success lines are excluded unless logged with summary = TRUE; a warning or error can be excluded with summary = FALSE.

Examples

logtree_reset()
f <- function() {
  log_step("Load data")
  log_warn("coerced 3 rows")
}
f()
#>  Load data
#> ├─  coerced 3 rows
#> └─  Done  0.00s
logtree_summary()
#> Summary: 1 warning
#>  Load data > coerced 3 rows