| 1 |
#' Get and set logging level |
| 2 |
#' |
| 3 |
#' The logging level for later can be set to report differing levels of |
| 4 |
#' information. Possible logging levels (from least to most information |
| 5 |
#' reported) are: \code{"OFF"}, \code{"ERROR"}, \code{"WARN"}, \code{"INFO"}, or |
| 6 |
#' \code{"DEBUG"}. The default level is \code{ERROR}. |
| 7 |
#' |
| 8 |
#' @param level The logging level. Must be one of \code{NULL}, \code{"OFF"}, |
| 9 |
#' \code{"ERROR"}, \code{"WARN"}, \code{"INFO"}, or \code{"DEBUG"}. If |
| 10 |
#' \code{NULL} (the default), then this function simply returns the current |
| 11 |
#' logging level. |
| 12 |
#' |
| 13 |
#' @return If \code{level=NULL}, then this returns the current logging level. If |
| 14 |
#' \code{level} is any other value, then this returns the previous logging |
| 15 |
#' level, from before it is set to the new value. |
| 16 |
#' |
| 17 |
#' @keywords internal |
| 18 |
logLevel <- function(level = NULL) { |
| 19 |
if (is.null(level)) { |
| 20 |
level <- "" |
| 21 |
log_level("") |
| 22 |
} else { |
| 23 |
level <- match.arg(level, c("OFF", "ERROR", "WARN", "INFO", "DEBUG")) |
| 24 |
invisible(log_level(level)) |
| 25 |
} |
| 26 |
} |