unnecessary system sleep in logger_init
function logger_init features a Sys.sleep(2) that can be removed without failing tests or producing weird output. Any idea why it's there?
logger_init <- function(logger_settings) {
# defaulting to console
appender <- logger::appender_console
# validate logger if file is specified for TEE (console + file) and FILE (file
# only) logging
if (logger_settings$appender %in% c("TEE", "FILE")) {
validate_required_field("file", logger_settings)
}
if (logger_settings$appender == "TEE") {
file.create(
logger_settings$file,
recursive = TRUE,
overwrite = TRUE,
showWarnings = FALSE
)
appender <-
logger::appender_tee(logger_settings$file, append = TRUE)
} else if (logger_settings$appender == "FILE") {
file.create(
logger_settings$file,
recursive = TRUE,
overwrite = TRUE,
showWarnings = FALSE
)
appender <-
logger::appender_file(logger_settings$file, append = TRUE)
}
Sys.sleep(2)
log_layout <-
logger::layout_glue_generator(
format = "{level}\t [{format(time,\"%Y-%m-%d %H:%M:%S\")}]\t {msg}"
)
# override global logger
logger::log_appender(appender)
logger::log_layout(log_layout)
logger::log_threshold(logger_settings$threshold)
# set header
logger::log_layout(logger::layout_blank, namespace = "header")
logger::log_appender(appender, namespace = "header")
logger::log_threshold(logger::INFO, namespace = "header")
}
══ Results ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 92.1 s
── Skipped tests (1) ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• empty test (1): test-maps.R:3:1
[ FAIL 0 | WARN 0 | SKIP 1 | PASS 11 ]
Edited by Stijn Peeters