Learn R Programming

BBmisc (version 1.5)

makeSimpleFileLogger: Simple logger which outputs to a file.

Description

Creates a simple file logger closure to log to a file, including time stamps. An optional buffer holds the last few log messages.

Usage

makeSimpleFileLogger(logfile, touch = FALSE, keep = 10L)

Arguments

logfile
[character(1)] File to log to.
touch
[logical(1)] Should the file be created before the first log message? Default is FALSE.
keep
[integer(1)] Number of log messages to keep in memory for quick access. Default is 10.

Value

  • [SimpleFileLogger]. A list with following functions:
  • log [function(msg)]Send log message.
  • getMessages [function(n)]Get last n log messages.
  • clear [function()]Resets logger and deletes log file.
  • getSize [function()]Returns the number of logs written.
  • getLogfile [function()]Returns the full file name logs are written to.