loggit
loggit copied to clipboard
Error in rotate_logs if there are less than rotate_lines lines in logfile
Thank you for this very useful tool! Unfortunately, rotate_logs() will cause an error ("Error in xj[i] : only 0's may be mixed with negative subscripts") if there are less than rotate_lines lines in the logfile.
I suggest the following fix: Replace lines 85-86 of loggit/R/utils.R with
if (nrow(log_df) > rotate_lines) {
log_df <- log_df[(nrow(log_df) - rotate_lines + 1):nrow(log_df), ]
write_ndjson(log_df, logfile, echo = FALSE, overwrite = TRUE)
}
Hey @VZoche-Golob , my impression is that the package is no longer being developed. Since I have created a few issues and PRs here myself and have not received any responses, I have published a fork on Cran:
https://cran.r-project.org/package=loggit2
Maybe it will help you. Your bug is also fixed there.