Learn R Programming

chronicler (version 0.3.0)

read_log: Read and display the log of a chronicle

Description

read_log() provides different human-readable views of the log information stored in a chronicle object. It can show a pretty, narrative-style summary, a tabular summary suitable for inspection or debugging, or a compact error-focused report.

Usage

read_log(.c, style = c("pretty", "table", "errors-only"))

Value

  • If style = "pretty": a character vector of sentences.

  • If style = "table": a data frame summarising the log (with an attribute "total_runtime_secs" storing the total runtime in seconds).

  • If style = "errors-only": a character string if all succeeded, or a character vector listing only the failed steps.

Arguments

.c

A chronicle object.

style

A string indicating the display style. One of:

  • "pretty": a short, human-friendly log with OK/NOK status, function names, timestamps, and runtimes.

  • "table": a tabular summary of the log as a data frame, including function names, status, runtime, and messages.

  • "errors-only": a minimal report. If all steps succeed, only a single success message is shown. If any step fails, only the failures are listed.

Examples

Run this code
r_select <- record(dplyr::select)
r_group_by <- record(dplyr::group_by)
r_summarise <- record(dplyr::summarise)

output <- dplyr::starwars |>
  r_select(height, mass, species, sex) |>
  bind_record(r_group_by, species, sex) |>
  bind_record(r_summarise, mass = mean(mass, na.rm = TRUE))

read_log(output, style = "pretty")
read_log(output, style = "table")
read_log(output, style = "errors-only")

Run the code above in your browser using DataLab