Skip to content

Commit

Permalink
revert #147 for atalv/azlogr#35
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Mar 5, 2024
1 parent fed038f commit 2ff43d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Many unrelated small features, fixes and documentation updates collected over 2+
* new formatter function: `formatter_glue_safe` (#126, @terashim)
* support `OFF` log level (#138, @pawelru)
* override default `INFO` log level via env var (#145, requested by sellorm)
* warn when `formatter_glue` returns nothing (#147, reported by @r2evans)

## Fixes

Expand Down
9 changes: 5 additions & 4 deletions R/formatters.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ formatter_glue <- structure(function(..., .logcall = sys.call(), .topcall = sys.
}))
## throw warning with logger inputs on empty response
if (length(message) == 0) {
try(warning(paste(
"glue in formatter_glue returned nothing with the following parameters:",
paste(..., sep = ' | ')
)), silent = TRUE)
## disabled until azlogr drops test for no warning here: https://github.com/atalv/azlogr/issues/35
## try(warning(paste(
## 'glue in formatter_glue returned nothing with the following parameters:',
## paste(..., sep = ' | ')
## )), silent = TRUE)
}
message
}, generator = quote(formatter_glue()))
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-formatters.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ test_that('glue works', {
expect_error(formatter_glue('malformed {'))
expect_error(formatter_glue('malformed {{'), NA)

expect_warning(formatter_glue(NULL))
expect_warning(log_info(NULL))
expect_warning(log_info(a = 42, b = "foobar"))
## disabled for https://github.com/atalv/azlogr/issues/35
## expect_warning(formatter_glue(NULL))
## expect_warning(log_info(NULL))
## expect_warning(log_info(a = 42, b = "foobar"))
log_appender(appender_stdout)

})
Expand Down

0 comments on commit 2ff43d0

Please sign in to comment.