library(logr)
# Create temp file location
tmp <- file.path(tempdir(), "test.log")
# Open log
lf <- log_open(tmp)
# Send error message to log
log_error("Here is a error")
# Close log
log_close()
# View results
writeLines(readLines(lf))
Run the code above in your browser using DataLab