rotate_logs {loggit2} | R Documentation |
Truncates the log file to the line count provided as rotate_lines
.
rotate_logs(rotate_lines = 100000L, logfile = get_logfile())
rotate_lines |
The number of log entries to keep in the logfile. |
logfile |
Log file to truncate. |
Invisible NULL
.
# Truncate "default" log file to 100 lines
set_logfile()
for (i in 1:150) {loggit("INFO", i, echo = FALSE)}
rotate_logs(100)
# Truncate a different log file to 250 lines
another_log <- file.path(tempdir(), "another.log")
set_logfile(another_log)
for (i in 1:300) {loggit("INFO", i, echo = FALSE)}
set_logfile() # clears pointer to other log file
rotate_logs(250, another_log)