log_file: Activate a log file

Description Usage Arguments Value Examples

Description

log_file creates an active instance of a log file to which loggr can pass errors, warnings and messages. If this file already exists, it will be appended to unless overwrite is set to TRUE.

Usage

1
2
3
log_file(file_name, ..., .warning = TRUE, .error = TRUE, .message = TRUE,
  .formatter = format_log_entry, subscriptions = NULL, overwrite = TRUE,
  log_muffled = FALSE)

Arguments

file_name

the path to the log file.

...

list of quoted or unquoted events to log. In none are provided all log events will be captured.

.warning

logical: capture regular warnings (simpleWarning)?

.error

logical: capture regular errors (simpleError)?

.message

logical: capture regular messages (simpleMessage)?

.formatter

function: the formatting function used to convert a log event to its character representation for the log file.

subscriptions

character vector: optional list of subscriptions to use (in place of specifying with ...).

overwrite

logical: whether or not to overwrite the file at file_name if it already exists. Set to TRUE by default.

log_muffled

logical: Log messages and warnings even if muffled? This affects only logging as result of warning and message.

Value

NULL, invisibly.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
#Create a "default" log file instance
log_file()

#Create a log file instance that only checks errors
log_file("errors_only_thanks.log", ERROR, CRITICAL,
         .warning = FALSE, .message = FALSE)

## End(Not run)

smbache/loggr documentation built on May 30, 2019, 5:02 a.m.