Create a standard set of MazamaCoreUtils log files.
initializeLogging(logDir = NULL, filePrefix = "", createDir = TRUE)No return value. Called for side effects.
This convenience function creates or validates a log directory, archives any
existing standard log files by appending a UTC timestamp, and then initializes
logging with logger.setup().
Standard log files include:
TRACE.log
DEBUG.log
INFO.log
WARN.log
ERROR.logWhen filePrefix is supplied, it is prepended to each log file name.
logDir <- file.path(tempdir(), "logs")
initializeLogging(logDir, filePrefix = "example_")
logger.info("Processing started")
logger.error("Something went wrong")
list.files(logDir)
#> [1] "example_DEBUG.log" "example_ERROR.log" "example_INFO.log"
#> [4] "example_TRACE.log"
readLines(file.path(logDir, "example_INFO.log"))
#> [1] "INFO [2026-09-30 19:01:52 UTC] Processing started"
#> [2] "ERROR [2026-09-30 19:01:52 UTC] Something went wrong"