From e2762267838fa518ae3051bf04aef50b736a6f02 Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Mon, 7 Sep 2026 17:03:12 +0200 Subject: [PATCH 1/3] Make sure we evaluate in the current caller env --- R/helpers.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/helpers.R b/R/helpers.R index dbe7544c..b01ec020 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -165,7 +165,7 @@ log_with_separator <- function(..., .topenv = parent.frame() ) - message <- do.call(eval(log_formatter()), list(...)) + message <- do.call(eval(log_formatter()), list(...), envir = parent.frame()) message <- strwrap(message, max(0, width - base_info_chars - 4)) message <- sapply(message, function(m) { paste0( From 6640fc84dea4c034ede28e4c31be75c03f167f14 Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Mon, 7 Sep 2026 17:03:25 +0200 Subject: [PATCH 2/3] add test for call from inside a function --- tests/testthat/test-helpers.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testthat/test-helpers.R b/tests/testthat/test-helpers.R index 206c7fa9..fc7eeb6c 100644 --- a/tests/testthat/test-helpers.R +++ b/tests/testthat/test-helpers.R @@ -47,6 +47,8 @@ test_that("log with separator", { local_test_logger() expect_output(log_with_separator(42), "===") expect_output(log_with_separator("Boo!", level = FATAL, width = 120), width = 120) + test_fct <- function(x) log_with_separator("{x}") + expect_output(test_fct("Hello World!")) }) test_that("log failure", { From bcb985930df7875d43accf32e9b57c0a9cc9e05b Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Wed, 9 Sep 2026 10:57:26 +0200 Subject: [PATCH 3/3] usethis::use_dev_version() and news bullet --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 29d29866..5d28e5e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: logger Title: A Lightweight, Modern and Flexible Logging Utility -Version: 0.4.3 +Version: 0.4.3.9000 Date: 2026-08-23 Authors@R: c( person("Gergely", "Daróczi", , "daroczig@rapporter.net", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 04154bc0..7585c9ca 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# logger (development version) + +* `log_with_separator()` now correctly evaluates in the caller environment, so it behaves as expected when wrapped in a function call. (#245) + # logger 0.4.3 (2026-08-23) Maintenance release: