The log is initialized with log_open
. Once the log is open, objects
like variables and data frames can be printed to the log to monitor execution
of your script. If working interactively, the function will print both to
the log and to the console. The log_print
function is useful when
writing and debugging batch scripts, and in situations where some record
of a scripts' execution is required.
If requested in the log_open
function, log_print
will print a note after each call. The note will contain a date-time stamp
and elapsed time since the last call to log_print
. When printing
a data frame, the log_print
function will also print the number
and rows and column in the data frame. These counts may also be useful
in debugging.
Notes may be turned off either by setting the show_notes
parameter
on log_open
to FALSE, or by setting the global option "logr.notes"
to FALSE.
The put
function is a shorthand alias for log_print
. You can
use put
anywhere you would use log_print
. The functionality
is identical.
The sep
function is also a shorthand alias for log_print
,
except it will print a separator before and after the printed text. This
function is intended for documentation purposes, and you can use it
to help organize your log into sections.
The log_hook
function is for other packages that wish to
integrate with logr. The function prints to the log only if
autolog
is enabled. It will not print to the console.