% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils-logging.R
\name{logger.setup}
\alias{logger.setup}
\title{Set up Python-style logging}
\usage{
logger.setup(
  traceLog = NULL,
  debugLog = NULL,
  infoLog = NULL,
  warnLog = NULL,
  errorLog = NULL,
  fatalLog = NULL
)
}
\arguments{
\item{traceLog}{File path receiving \code{TRACE} messages.}

\item{debugLog}{File path receiving \code{DEBUG} messages.}

\item{infoLog}{File path receiving \code{INFO} messages.}

\item{warnLog}{File path receiving \code{WARN} messages.}

\item{errorLog}{File path receiving \code{ERROR} messages.}

\item{fatalLog}{File path receiving \code{FATAL} messages.}
}
\value{
No return value. Called for side effects.
}
\description{
Configure level-specific log files using the package logging API.
}
\details{
Logging is built on top of the \href{https://daroczig.github.io/logger/}{logger}
package while retaining the historical MazamaCoreUtils logging interface.

Separate log files can be created for different log levels so that, for
example, an \code{errorLog} contains only \code{ERROR} and \code{FATAL} messages while a
\code{debugLog} contains \code{DEBUG} messages as well as all higher-severity messages.

Any log file argument left as \code{NULL} is disabled and no file will be created
for that level.

After initialization, logging statements can be generated with:
\code{logger.trace()}, \code{logger.debug()}, \code{logger.info()},
\code{logger.warn()}, \code{logger.error()}, and \code{logger.fatal()}.

Log messages are formatted with:

\preformatted{
LEVEL [YYYY-MM-DD HH:MM:SS UTC] message
}

Console logging is enabled by default only for \code{FATAL} messages. Use
\code{\link[=logger.setLevel]{logger.setLevel()}} to display additional log messages in the console.
}
\note{
All functionality is implemented with the excellent \pkg{logger} package.
}
\examples{
\dontrun{
# Create three log files
logger.setup(
  debugLog = "debug.log",
  infoLog = "info.log",
  errorLog = "error.log"
)

# Generate log messages
logger.trace("trace statement #\%d", 1)
logger.debug("debug statement")
logger.info("info statement \%s \%s", "with", "arguments")
logger.warn("warn statement: \%s", "about to try something risky")

result <- try(1 / "a", silent = TRUE)
logger.error("error message: \%s", geterrmessage())
logger.fatal("fatal statement: \%s", "THE END")

cat(readLines("debug.log"), sep = "\n")
cat(readLines("info.log"), sep = "\n")
cat(readLines("error.log"), sep = "\n")
}

}
\seealso{
\code{\link[=logger.trace]{logger.trace()}}, \code{\link[=logger.debug]{logger.debug()}}, \code{\link[=logger.info]{logger.info()}},
\code{\link[=logger.warn]{logger.warn()}}, \code{\link[=logger.error]{logger.error()}}, \code{\link[=logger.fatal]{logger.fatal()}}
}
