Useful for e.g. read and write operations on databases etc. that are not automatically captured.
log_read(file, log = Sys.getenv("WHIRL_LOG_MSG"))
log_write(file, log = Sys.getenv("WHIRL_LOG_MSG"))
log_delete(file, log = Sys.getenv("WHIRL_LOG_MSG"))
character()
description of the file that was read, written or
deleted.
character()
path to the log file.
The default environment variable WHIRL_LOG_MSG
is set in the session used
to log scripts, and input is automatically captured in the resulting log.
If run outside of whirl, meaning when the above environment variable is
unset, the operations are streamed to stdout()
. By default the console.
# Stream logs to console since `WHIRL_LOG_MSG` is not set:
log_read("my/folder/input.txt")
#> {"time":"2025-06-30 19:42:44","type":"read","file":"my/folder/input.txt"}
log_write("my/folder/output.txt")
#> {"time":"2025-06-30 19:42:44","type":"write","file":"my/folder/output.txt"}
log_delete("my/folder/old_output.txt")
#> {"time":"2025-06-30 19:42:44","type":"delete","file":"my/folder/old_output.txt"}