tests/testthat/setup-logger.R

## Configure logger (suppress all logs in testing) ##

# Save original threshold to reset later
loggerOptions <- futile.logger::logger.options()
if (!identical(loggerOptions, list())){
    origLogThreshold <- loggerOptions[[1]][['threshold']]
} else {
    origLogThreshold <- futile.logger::INFO
}
Sys.setenv(PKGNET_TEST_ORIG_LOG_THRESHOLD = origLogThreshold)

# Silence logger
futile.logger::flog.threshold(
    threshold = 0
    , name = futile.logger::flog.namespace()
)

Try the pkgnet package in your browser

Any scripts or data that you put into this service are public.

pkgnet documentation built on Dec. 23, 2021, 9:07 a.m.