diff --git a/DESCRIPTION b/DESCRIPTION index 886713d6..df5cccd2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ Date: 2024-03-03 URL: https://daroczig.github.io/logger/ BugReports: https://github.com/daroczig/logger/issues Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 License: AGPL-3 Imports: utils diff --git a/R/appenders.R b/R/appenders.R index a8935de3..4af18a58 100644 --- a/R/appenders.R +++ b/R/appenders.R @@ -7,11 +7,6 @@ appender_void <- structure(function(lines) {}, generator = quote(appender_void() #' Append log record to stderr #' @param lines character vector #' @export -#' @aliases appender_stderr -#' @usage -#' appender_console(lines) -#' -#' appender_stderr(lines) #' @seealso This is a \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_stdout}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_slack}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process. appender_console <- structure(function(lines) { cat(lines, file = stderr(), sep = '\n') @@ -19,6 +14,7 @@ appender_console <- structure(function(lines) { #' @export +#' @rdname appender_console appender_stderr <- appender_console diff --git a/R/levels.R b/R/levels.R index d7a7b02d..74e0e8a8 100644 --- a/R/levels.R +++ b/R/levels.R @@ -16,39 +16,40 @@ log_levels_supported <- c('OFF', 'FATAL', 'ERROR', 'WARN', 'SUCCESS', 'INFO', 'D #' \item \code{TRACE} A fine-grained debug message, typically capturing the flow through the application. #' } #' @references \url{https://logging.apache.org/log4j/2.x/javadoc/log4j-api/org/apache/logging/log4j/Level.html}, \url{https://logging.apache.org/log4j/2.x/manual/customloglevels.html} -#' @aliases log_levels OFF FATAL ERROR WARN SUCCESS INFO DEBUG TRACE +#' @name log_levels +NULL + #' @rdname log_levels -#' @usage -#' TRACE -#' -#' DEBUG -#' -#' INFO -#' -#' SUCCESS -#' -#' WARN -#' -#' ERROR -#' -#' FATAL -#' -#' OFF #' @export +#' @format NULL OFF <- structure(0L, level = 'OFF', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL FATAL <- structure(100L, level = 'FATAL', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL ERROR <- structure(200L, level = 'ERROR', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL WARN <- structure(300L, level = 'WARN', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL SUCCESS <- structure(350L, level = 'SUCCESS', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL INFO <- structure(400L, level = 'INFO', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL DEBUG <- structure(500L, level = 'DEBUG', class = c('loglevel', 'integer')) #' @export +#' @rdname log_levels +#' @format NULL TRACE <- structure(600L, level = 'TRACE', class = c('loglevel', 'integer')) #' @export diff --git a/R/logger.R b/R/logger.R index c5bc2319..ba1b8da0 100644 --- a/R/logger.R +++ b/R/logger.R @@ -247,31 +247,6 @@ log_namespaces <- function() { #' @param .topenv original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name} #' @seealso \code{\link{logger}} #' @export -#' @aliases log_level log_fatal log_error log_warn log_success log_info log_debug log_trace -#' @usage -#' log_level(level, ..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_trace(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_debug(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_info(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_success(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_warn(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_error(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) -#' -#' log_fatal(..., namespace = NA_character_, -#' .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) #' @examples \dontrun{ #' log_level(INFO, 'hi there') #' log_info('hi there') @@ -352,36 +327,43 @@ validate_log_level <- function(level) { #' @export +#' @rdname log_level log_fatal <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(FATAL, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_error <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(ERROR, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_warn <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(WARN, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_success <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(SUCCESS, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_info <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(INFO, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_debug <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(DEBUG, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) } #' @export +#' @rdname log_level log_trace <- function(..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) { log_level(TRACE, ..., namespace = namespace, .logcall = .logcall, .topcall = .topcall, .topenv = .topenv) diff --git a/man/log_level.Rd b/man/log_level.Rd index adcac818..2b973798 100644 --- a/man/log_level.Rd +++ b/man/log_level.Rd @@ -11,29 +11,70 @@ \alias{log_trace} \title{Log a message with given log level} \usage{ -log_level(level, ..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_trace(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_debug(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_info(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_success(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_warn(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_error(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) - -log_fatal(..., namespace = NA_character_, - .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) +log_level( + level, + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_fatal( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_error( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_warn( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_success( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_info( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_debug( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) + +log_trace( + ..., + namespace = NA_character_, + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) } \arguments{ \item{level}{log level, see \code{\link{log_levels}} for more details} diff --git a/man/log_levels.Rd b/man/log_levels.Rd index 75fc8b4f..9b2b4b93 100644 --- a/man/log_levels.Rd +++ b/man/log_levels.Rd @@ -1,9 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/levels.R \docType{data} -\name{OFF} -\alias{OFF} +\name{log_levels} \alias{log_levels} +\alias{OFF} \alias{FATAL} \alias{ERROR} \alias{WARN} @@ -12,25 +12,22 @@ \alias{DEBUG} \alias{TRACE} \title{Log levels} -\format{ -An object of class \code{loglevel} (inherits from \code{integer}) of length 1. -} \usage{ -TRACE - -DEBUG +OFF -INFO +FATAL -SUCCESS +ERROR WARN -ERROR +SUCCESS -FATAL +INFO -OFF +DEBUG + +TRACE } \description{ The standard Apache logj4 log levels plus a custom level for \code{SUCCESS}. For the full list of these log levels and suggested usage, check the below Details.