diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b29560b..1d079690 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,7 @@ repos: - ggplot2 - grDevices - lifecycle + - logger - methods - rlang - shinyjs diff --git a/DESCRIPTION b/DESCRIPTION index d41c7edf..6e823044 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,6 +42,7 @@ Imports: ggplot2 (>= 3.4.0), grDevices, lifecycle (>= 0.2.0), + logger (>= 0.3.0), methods, rlang (>= 1.0.0), shinyjs, @@ -66,8 +67,8 @@ VignetteBuilder: Config/Needs/verdepcheck: insightsengineering/goshawk, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.transform, mllg/checkmate, daattali/colourpicker, tidyverse/dplyr, rstudio/DT, - tidyverse/ggplot2, r-lib/lifecycle, r-lib/rlang, daattali/shinyjs, - rstudio/shinyvalidate, insightsengineering/teal.code, + tidyverse/ggplot2, r-lib/lifecycle, daroczig/logger, r-lib/rlang, + daattali/shinyjs, rstudio/shinyvalidate, insightsengineering/teal.code, insightsengineering/teal.logger, insightsengineering/teal.reporter, insightsengineering/teal.widgets, tidyverse/tidyr, yihui/knitr, insightsengineering/nestcolor, rstudio/rmarkdown, tidyverse/stringr, diff --git a/NEWS.md b/NEWS.md index 63c30f35..dd881841 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,7 @@ * Adapted all modules to use `teal_data` objects. ### Enhancements - +* Added `logger` functionality for logging changes in shiny inputs in all modules. `logger` was added to Imports. * Updated the documentation and vignettes to demonstrate method to pass `teal_data` object to `teal::init()`. ### Miscellaneous diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index 395a4b73..8688687b 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -326,6 +326,7 @@ srv_g_boxplot <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") output$axis_selections <- renderUI({ env <- shiny::isolate(as.list(data()@env)) resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index 0fde3625..77da6ddf 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -382,6 +382,7 @@ srv_g_correlationplot <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") output$axis_selections <- renderUI({ env <- shiny::isolate(as.list(data()@env)) resolved_x_param <- teal.transform::resolve_delayed(module_args$xaxis_param, env) diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index e079619e..0d421d4a 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -268,6 +268,7 @@ srv_g_density_distribution_plot <- function(id, # nolint checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") output$axis_selections <- renderUI({ env <- shiny::isolate(as.list(data()@env)) resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index 3444a6c5..81415892 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -329,6 +329,7 @@ srv_lineplot <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") ns <- session$ns output$axis_selections <- renderUI({ diff --git a/R/tm_g_gh_scatterplot.R b/R/tm_g_gh_scatterplot.R index ecfc6521..29d31f1c 100644 --- a/R/tm_g_gh_scatterplot.R +++ b/R/tm_g_gh_scatterplot.R @@ -267,6 +267,7 @@ srv_g_scatterplot <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") output$axis_selections <- renderUI({ env <- shiny::isolate(as.list(data()@env)) resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) diff --git a/R/tm_g_gh_spaghettiplot.R b/R/tm_g_gh_spaghettiplot.R index 94f1bb6c..ab5a0d94 100644 --- a/R/tm_g_gh_spaghettiplot.R +++ b/R/tm_g_gh_spaghettiplot.R @@ -344,6 +344,7 @@ srv_g_spaghettiplot <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") output$axis_selections <- renderUI({ env <- shiny::isolate(as.list(data()@env)) resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) diff --git a/R/toggleable_slider.R b/R/toggleable_slider.R index 1fb9a986..28863748 100644 --- a/R/toggleable_slider.R +++ b/R/toggleable_slider.R @@ -142,6 +142,7 @@ toggle_slider_ui <- function(id, # is_dichotomous_slider `logical` whether it is a dichotomous slider or normal slider toggle_slider_server <- function(id, is_dichotomous_slider = TRUE) { moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") checkmate::assert_flag(is_dichotomous_slider) # model view controller: cur_state is the model, the sliderInput and numericInputs are two views/controllers # additionally, the module returns the cur_state, so it can be controlled from that end as well diff --git a/R/utils-arbitrary_lines.r b/R/utils-arbitrary_lines.r index 82e4f882..eb9fa806 100644 --- a/R/utils-arbitrary_lines.r +++ b/R/utils-arbitrary_lines.r @@ -48,6 +48,7 @@ ui_arbitrary_lines <- function(id, line_arb, line_arb_label, line_arb_color, tit #' @keywords internal srv_arbitrary_lines <- function(id) { moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.goshawk") comma_sep_to_values <- function(values, wrapper_fun = trimws) { vals <- strsplit(values, "\\s{0,},\\s{0,}")[[1]] suppressWarnings(wrapper_fun(vals))