verbose()
TRUE
if you have
options(verbose=T)
or if the
environment variable
S_LOGFILE
has been set (presumably to the name of a log file).
The
logcat
function does nothing
if
verbose()
returns
FALSE
,
so this is not necessary for correct use of
logcat
.
However, if it is time consuming to prepare the report for the log file, then
use the idiom
if(verbose()) { x<-getDetails(); logcat(x) }
so as not to bother folks who do not want the logging. (Because of lazy
evaluation,
logcat(getDetails())
would not evaluate
getDetails()
unless its output were to be logged,
but there may be more complicated situations where this is handy.)
options(verbose=T) if(verbose()) { logcat(paste("Current option settings are\n", paste(collapse="\n", deparse(options())))) } # Note: current option settings are # ...