If users decide to pipe the results of main()
or any of the
logging-related functions into a log file, the contents of log file
can be parsed and stored in a tibble using survey_log()
. Only
the messages from the log_*()
functions will be parsed, all other output
from the code will be ignored.
See also
Other survey:
survey_strata()
,
survey_tomls()
Other log:
log_error()
,
log_message()
,
log_total_time()
Examples
tmp <- fs::dir_create(fs::file_temp())
log <- fs::file_create(fs::path(tmp, "main.log"))
fake_log_message <- log_message("example message")
#> [2025-02-03 21:45:58.4359] INFO: example message
cat(fake_log_message, file = log)
survey_log(log)
#> Warning: incomplete final line found on '/tmp/RtmpKn24Yq/file1e509b0d325/main.log'
#> # A tibble: 1 × 4
#> line_number timestamp level message
#> <int> <dttm> <chr> <chr>
#> 1 1 2025-02-03 21:45:58 INFO example message
fs::dir_delete(tmp)