From eeca801c334e8fe5892984e2f8ef7cc3ddc22737 Mon Sep 17 00:00:00 2001 From: "Gergely Daroczi (@daroczig)" Date: Wed, 3 Mar 2021 16:20:09 +0100 Subject: [PATCH] hide require/library calls in background process due to R CMD check --- DESCRIPTION | 4 ++-- R/appenders.R | 5 +++-- inst/load-packages-in-background-process.R | 4 ++++ man/log_levels.Rd | 4 +++- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 inst/load-packages-in-background-process.R diff --git a/DESCRIPTION b/DESCRIPTION index 1e1eeea..3255958 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,11 +7,11 @@ Authors@R: c( Title: A Lightweight, Modern and Flexible Logging Utility Description: Inspired by the the 'futile.logger' R package and 'logging' Python module, this utility provides a flexible and extensible way of formatting and delivering log messages with low overhead. Version: 0.2.0 -Date: 2020-11-17 +Date: 2021-03-03 URL: https://daroczig.github.io/logger/ BugReports: https://github.com/daroczig/logger/issues Encoding: UTF-8 -RoxygenNote: 7.0.2 +RoxygenNote: 7.1.1 License: AGPL-3 Imports: utils diff --git a/R/appenders.R b/R/appenders.R index c021aa5..58994db 100644 --- a/R/appenders.R +++ b/R/appenders.R @@ -345,8 +345,9 @@ appender_async <- function(appender, batch = 1, namespace = 'async_logger', log_trace(paste('Async writer PID:', async_writer_process$get_pid()), namespace = 'async_logger') ## load minimum required packages - async_writer_process$run(function() require('logger')) - async_writer_process$run(function() require('txtq')) + async_writer_process$run(function() source(system.file( + 'load-packages-in-background-process.R', + package = 'logger'))) async_writer_process$run(init) ## connect to the message queue diff --git a/inst/load-packages-in-background-process.R b/inst/load-packages-in-background-process.R new file mode 100644 index 0000000..350f4a2 --- /dev/null +++ b/inst/load-packages-in-background-process.R @@ -0,0 +1,4 @@ +## this is to be called in the background process of appender_async +## because having library/require calls in that function throws false R CMD check alerts +require('logger') +require('txtq') diff --git a/man/log_levels.Rd b/man/log_levels.Rd index e41d1d3..421048b 100644 --- a/man/log_levels.Rd +++ b/man/log_levels.Rd @@ -11,7 +11,9 @@ \alias{DEBUG} \alias{TRACE} \title{Log levels} -\format{An object of class \code{loglevel} (inherits from \code{integer}) of length 1.} +\format{ +An object of class \code{loglevel} (inherits from \code{integer}) of length 1. +} \usage{ TRACE