daroczig / logger

A lightweight, modern and flexible, log4j and futile.logger inspired logging utility for R
https://daroczig.github.io/logger
285 stars 42 forks source link

activating `log_errors()` multiple times returns multiple lines of same error log #109

Closed przell closed 7 months ago

przell commented 2 years ago

Hi, just came across that activating log_errors() multiple time multiplies the error messages.

log_errors()
log_failure(stopifnot(1 ==2))
ERROR [2022-06-17 07:28:47] 1 == 2 is not TRUE
ERROR [2022-06-17 07:28:47] 1 == 2 is not TRUE
Error: 1 == 2 is not TRUE
log_errors()
log_failure(stopifnot(1 ==2))
ERROR [2022-06-17 07:29:07] 1 == 2 is not TRUE
ERROR [2022-06-17 07:29:07] 1 == 2 is not TRUE
ERROR [2022-06-17 07:29:07] 1 == 2 is not TRUE
Error: 1 == 2 is not TRUE
log_errors()
log_failure(stopifnot(1 ==2))
ERROR [2022-06-17 07:29:17] 1 == 2 is not TRUE
ERROR [2022-06-17 07:29:17] 1 == 2 is not TRUE
ERROR [2022-06-17 07:29:17] 1 == 2 is not TRUE
ERROR [2022-06-17 07:29:17] 1 == 2 is not TRUE
Error: 1 == 2 is not TRUE
razz-matazz commented 1 year ago

Hello,

Just wanted to let @daroczig know that even when you run the same script (e.g. starting a shiny app), it leads to multiple lines.

Are there any workarounds?

daroczig commented 7 months ago

Sorry for the long delay with getting back on this :disappointed: Thanks for the report! This seems to be a duplicate of #88, which was fixed a couple of months ago, so closing this. Please reopen if you see otherwise.