Skip to content

Commit

Permalink
register teal.logger handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelru committed Feb 1, 2024
1 parent 6e1a17d commit ecce83d
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ repos:
- DT
- forcats
- grid
- logger
- magrittr
- scales
- shinyjs
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Imports:
DT (>= 0.13),
forcats (>= 1.0.0),
grid,
logger (>= 0.2.0),
magrittr (>= 1.5),
scales,
shinyjs,
Expand All @@ -38,7 +37,7 @@ Imports:
stats,
stringr (>= 1.4.1),
teal.code (>= 0.4.1.9009),
teal.logger (>= 0.1.1),
teal.logger (>= 0.1.3.9010),
teal.reporter (>= 0.2.0),
teal.widgets (>= 0.4.0),
tern (>= 0.7.10),
Expand All @@ -58,6 +57,7 @@ Suggests:
jsonlite,
knitr (>= 1.42),
lattice (>= 0.18-4),
logger (>= 0.2.0),
MASS,
methods,
nestcolor (>= 0.1.0),
Expand All @@ -71,15 +71,15 @@ VignetteBuilder:
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
rstudio/shiny, shinyTree/shinyTree, insightsengineering/teal,
mllg/checkmate, tidyverse/dplyr, rstudio/DT, tidyverse/forcats,
daroczig/logger, tidyverse/magrittr, r-lib/scales, daattali/shinyjs,
tidyverse/magrittr, r-lib/scales, daattali/shinyjs,
rstudio/shinyvalidate, dreamRs/shinyWidgets, tidyverse/stringr,
insightsengineering/teal.code, insightsengineering/teal.logger,
insightsengineering/teal.reporter, insightsengineering/teal.transform,
insightsengineering/teal.widgets, insightsengineering/tern,
tidyverse/tibble, tidyverse/tidyr, r-lib/tidyselect, tidymodels/broom,
daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp,
baddstats/goftest, gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite,
yihui/knitr, deepayan/lattice, MASS, insightsengineering/nestcolor,
yihui/knitr, deepayan/lattice, daroczig/logger, MASS, insightsengineering/nestcolor,
r-lib/rlang, insightsengineering/rtables, sparkline,
insightsengineering/teal.data, r-lib/testthat
Config/Needs/website: insightsengineering/nesttemplate
Expand Down
2 changes: 1 addition & 1 deletion R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tm_a_pca <- function(label = "Principal Component Analysis",
size = c(2, 1, 8),
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_a_pca")
message("Initializing tm_a_pca")
if (inherits(dat, "data_extract_spec")) dat <- list(dat)
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)

Expand Down
2 changes: 1 addition & 1 deletion R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tm_a_regression <- function(label = "Regression Analysis",
post_output = NULL,
default_plot_type = 1,
default_outlier_label = "USUBJID") {
logger::log_info("Initializing tm_a_regression")
message("Initializing tm_a_regression")
if (inherits(regressor, "data_extract_spec")) regressor <- list(regressor)
if (inherits(response, "data_extract_spec")) response <- list(response)
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tm_data_table <- function(label = "Data Table",
server_rendering = FALSE,
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_data_table")
message("Initializing tm_data_table")
checkmate::assert_string(label)
checkmate::assert_list(variables_selected, min.len = 0, types = "character", names = "named")
if (length(variables_selected) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#'
tm_file_viewer <- function(label = "File Viewer Module",
input_path = list("Current Working Directory" = ".")) {
logger::log_info("Initializing tm_file_viewer")
message("Initializing tm_file_viewer")
if (length(label) == 0 || identical(label, "")) {
label <- " "
}
Expand Down
2 changes: 1 addition & 1 deletion R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ tm_front_page <- function(label = "Front page",
checkmate::assert_character(footnotes, min.len = 0, any.missing = FALSE)
checkmate::assert_flag(show_metadata)

logger::log_info("Initializing tm_front_page")
message("Initializing tm_front_page")
args <- as.list(environment())

module(
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tm_g_association <- function(label = "Association",
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args()) {
logger::log_info("Initializing tm_g_association")
message("Initializing tm_g_association")
if (inherits(ref, "data_extract_spec")) ref <- list(ref)
if (inherits(vars, "data_extract_spec")) vars <- list(vars)
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
ggplot2_args = teal.widgets::ggplot2_args(),
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_bivariate")
message("Initializing tm_g_bivariate")
if (inherits(x, "data_extract_spec")) x <- list(x)
if (inherits(y, "data_extract_spec")) y <- list(y)
if (inherits(row_facet, "data_extract_spec")) row_facet <- list(row_facet)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ tm_g_distribution <- function(label = "Distribution Module",
plot_width = NULL,
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_distribution")
message("Initializing tm_g_distribution")

extra_packages <- c("ggpmisc", "ggpp", "goftest", "MASS", "broom")
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tm_g_response <- function(label = "Response Plot",
ggplot2_args = teal.widgets::ggplot2_args(),
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_response")
message("Initializing tm_g_response")
if (inherits(response, "data_extract_spec")) response <- list(response)
if (inherits(x, "data_extract_spec")) x <- list(x)
if (inherits(row_facet, "data_extract_spec")) row_facet <- list(row_facet)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ tm_g_scatterplot <- function(label = "Scatterplot",
post_output = NULL,
table_dec = 4,
ggplot2_args = teal.widgets::ggplot2_args()) {
logger::log_info("Initializing tm_g_scatterplot")
message("Initializing tm_g_scatterplot")

extra_packages <- c("ggpmisc", "ggExtra", "colourpicker")
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
plot_width = NULL,
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_scatterplotmatrix")
message("Initializing tm_g_scatterplotmatrix")
if (!requireNamespace("lattice", quietly = TRUE)) {
stop("Cannot load lattice - please install the package or restart your session.")
}
Expand Down
2 changes: 1 addition & 1 deletion R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tm_missing_data <- function(label = "Missing data",
if (!requireNamespace("rlang", quietly = TRUE)) {
stop("Cannot load rlang - please install the package or restart your session.")
}
logger::log_info("Initializing tm_missing_data")
message("Initializing tm_missing_data")
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)

checkmate::assert_string(label)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tm_outliers <- function(label = "Outliers Module",
plot_width = NULL,
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_outliers")
message("Initializing tm_outliers")
if (inherits(outlier_var, "data_extract_spec")) outlier_var <- list(outlier_var)
if (inherits(categorical_var, "data_extract_spec")) categorical_var <- list(categorical_var)
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ tm_t_crosstable <- function(label = "Cross Table",
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args()) {
logger::log_info("Initializing tm_t_crosstable")
message("Initializing tm_t_crosstable")
if (!requireNamespace("rtables", quietly = TRUE)) {
stop("Cannot load rtables - please install the package or restart your session.")
}
Expand Down
2 changes: 1 addition & 1 deletion R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tm_variable_browser <- function(label = "Variable Browser",
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args()) {
logger::log_info("Initializing tm_variable_browser")
message("Initializing tm_variable_browser")
if (!requireNamespace("sparkline", quietly = TRUE)) {
stop("Cannot load sparkline - please install the package or restart your session.")
}
Expand Down
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.onLoad <- function(libname, pkgname) { # nolint
teal.logger::register_logger(namespace = "teal.modules.general")
teal.logger::register_handlers("teal.modules.general")
}
1 change: 1 addition & 0 deletions tests/testthat/setup-logger.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
logger::log_appender(function(...) NULL, namespace = "teal.modules.general")

0 comments on commit ecce83d

Please sign in to comment.