Convenience function that wraps logging initialization steps common to Mazama Science web services:
result <- try({ Copy and old log files timestamp <- strftime(lubridate::now(), " for ( logLevel in c("TRACE","DEBUG","INFO","ERROR") ) { oldFile <- file.path(logDir,paste0(logLevel,".log")) newFile <- file.path(logDir,paste0(logLevel,".log.",timestamp)) if ( file.exists(oldFile) ) { file.rename(oldFile, newFile) } } }, silent=TRUE) stopOnError(result, "Could not rename old log files.")result <- try({ # Set up logging logger.setup(traceLog = file.path(logDir, "TRACE.log"), debugLog=file.path(logDir, "DEBUG.log"), infoLog=file.path(logDir, "INFO.log"), errorLog=file.path(logDir, "ERROR.log")) }, silent=TRUE) stopOnError(result, "Could not create log files.")
initializeLogging(logDir = NULL)
directory in which to write log files
No return value.