Skip to content

Commit

Permalink
Revert incidental changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 6, 2024
1 parent 4d25cb9 commit ab10db6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
25 changes: 12 additions & 13 deletions R/helpers.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Evaluate an expression and log results
#' @param expr R expression to be evaluated while logging the expression itself along with the result
#' @param level [log_levels()]
#' @param multiline setting to `FALSE` will print both the expression (enforced to be on one line by removing line-breaks if any) and its result on a single line separated by `=>`, while setting to `TRUE` will log the expression and the result in separate sections reserving line-breaks and rendering the printed results
#' @param level \code{\link{log_levels}}
#' @param multiline setting to \code{FALSE} will print both the expression (enforced to be on one line by removing line-breaks if any) and its result on a single line separated by \code{=>}, while setting to \code{TRUE} will log the expression and the result in separate sections reserving line-breaks and rendering the printed results
#' @examples \dontrun{
#' log_eval(pi * 2, level = INFO)
#'
Expand Down Expand Up @@ -90,7 +90,7 @@ log_eval <- function(expr, level = TRACE, multiline = FALSE) {
#' log_separator(ERROR, separator = '!', width = 100)
#' log_layout(layout_blank)
#' log_separator(ERROR, separator = '!', width = 80)
#' @seealso [log_with_separator()]
#' @seealso \code{\link{log_with_separator}}
log_separator <- function(level = INFO,
namespace = NA_character_,
separator = '=',
Expand All @@ -104,13 +104,12 @@ log_separator <- function(level = INFO,
base_info_chars <- nchar(catch_base_log(level, namespace, .topcall = .topcall, .topenv = .topenv))

log_level(
paste(rep(separator, max(0, width - base_info_chars)), collapse = ''),
level = level,
namespace = namespace,
.logcall = .logcall,
.topcall = .topcall,
.topenv = .topenv
)
paste(rep(separator, max(0, width - base_info_chars)), collapse = ''),
level = level,
namespace = namespace,
.logcall = .logcall,
.topcall = .topcall,
.topenv = .topenv)
}


Expand All @@ -135,7 +134,7 @@ log_separator <- function(level = INFO,
#' logger <- layout_glue_generator(format = '{node}/{pid}/{namespace}/{fn} {time} {level}: {msg}')
#' log_layout(logger)
#' log_with_separator('Boo!', level = FATAL, width = 120)
#' @seealso [log_separator()]
#' @seealso \code{\link{log_separator}}
log_with_separator <- function(..., level = INFO, namespace = NA_character_, separator = '=', width = 80) {

base_info_chars <- nchar(catch_base_log(level, namespace, .topcall = sys.call(-1)))
Expand Down Expand Up @@ -174,8 +173,8 @@ log_with_separator <- function(..., level = INFO, namespace = NA_character_, sep


#' Tic-toc logging
#' @param ... passed to `log_level`
#' @param level see [log_levels()]
#' @param ... passed to \code{log_level}
#' @param level see \code{\link{log_levels}}
#' @param namespace x
#' @export
#' @examples \dontrun{
Expand Down
1 change: 0 additions & 1 deletion R/logger.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ logger <- function(threshold, formatter, layout, appender) {
threshold <- validate_log_level(threshold)
force(layout)
force(appender)
stop("Here")

function(level, ..., namespace = NA_character_, .logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame()) {

Expand Down

0 comments on commit ab10db6

Please sign in to comment.