log_write()
gets and formats the content of the log.rx before writing it
to a log file
log_write(
file = NA,
remove_log_object = TRUE,
show_repo_url = FALSE,
include_rds = FALSE,
extra_info = NA,
to_report = c("messages", "output", "result")
)
String. Path to file executed
Boolean. Should the log object be removed after writing the log file? Defaults to TRUE
Boolean. Should the repo URLs be reported Defaults to FALSE
Boolean. Option to export log object as Rds file. Defaults to FALSE
List. Objects to add on to end of log in a special extra info section. Optional
String vector. Objects to optionally report; additional
information in axecute
Nothing
dir <- tempdir()
text <- 'print("Hello, Timberperson!")'
fileConn <- file(file.path(dir, "hello.R"))
writeLines(text, fileConn)
close(fileConn)
file <- file.path(dir, "hello.R")
# Initialise and configure the log.rx environment
log_config(file)
# Run the script and record results, outputs, messages, errors, and warnings
logrx:::run_safely_loudly(file)
#> [1] "Hello, Timberperson!"
# Write the log
log_write(file)