rotate_logs {loggit2}R Documentation

Rotate log file

Description

Truncates the log file to the line count provided as rotate_lines.

Usage

rotate_logs(rotate_lines = 100000L, logfile = get_logfile())

Arguments

rotate_lines

The number of log entries to keep in the logfile.

logfile

Log file to truncate.

Value

Invisible NULL.

Examples

  # 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)


[Package loggit2 version 2.2.2 Index]