1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logger.R
\name{vcr_logging}
\alias{vcr_logging}
\alias{vcr_log_file}
\alias{vcr_log_info}
\title{vcr log file setup}
\usage{
vcr_log_file(file, overwrite = TRUE)
vcr_log_info(message, include_date = TRUE)
}
\arguments{
\item{file}{(character) a file path, required}
\item{overwrite}{(logical) whether or not to overwrite the file at
'file' if it already exists. Default: \code{TRUE}}
\item{message}{(character) a message to log}
\item{include_date}{(logical) include date and time in each log entry.
Default: \code{FALSE}}
}
\description{
vcr log file setup
}
\examples{
# user workflow
vcr_configuration()
logfile <- file.path(tempdir(), "vcr.log")
vcr_configure(dir = tempdir(), log = TRUE, log_opts = list(file = logfile))
readLines(logfile) # empty
# log messages
vcr_log_info("hello world!")
readLines(logfile)
vcr_log_info("foo bar")
readLines(logfile)
## many messages
vcr_log_info(c("brown cow", "blue horse"))
readLines(logfile)
vcr_log_info(c("brown cow", "blue horse", "green goat"))
readLines(logfile)
# standalone workflow
# set a file to log to
vcr_log_file((f <- tempfile()))
readLines(f) # empty
# log messages
vcr_log_info("hello world!")
readLines(logfile)
vcr_log_info("foo bar")
readLines(logfile)
# cleanup
unlink(f)
unlink(logfile)
}
\keyword{internal}
|