Skip to content

Commit

Permalink
logging is now set in teal.logger
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Jun 18, 2024
1 parent 88e10a8 commit 66cdd94
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 37 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Imports:
stringr (>= 1.4.1),
teal.code (>= 0.5.0),
teal.data (>= 0.5.0),
teal.logger (>= 0.1.3.9013),
teal.logger (>= 0.2.1.9003),
teal.reporter (>= 0.3.0),
teal.widgets (>= 0.4.0),
tern (>= 0.9.3),
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 @@ -297,7 +297,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

response <- dat

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 @@ -371,7 +371,7 @@ srv_a_regression <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

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 @@ -182,7 +182,7 @@ srv_page_data_table <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

if_filtered <- reactive(as.logical(input$if_filtered))
if_distinct <- reactive(as.logical(input$if_distinct))
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 @@ -124,7 +124,7 @@ ui_viewer <- function(id, ...) {
# Server function for the file viewer module
srv_viewer <- function(id, input_path) {
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

temp_dir <- tempfile()
if (!dir.exists(temp_dir)) {
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 @@ -137,7 +137,7 @@ srv_front_page <- function(id, data, tables, show_metadata) {
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

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 @@ -285,7 +285,7 @@ srv_tm_g_association <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(ref = ref, vars = vars),
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 @@ -459,7 +459,7 @@ srv_g_bivariate <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

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 @@ -356,7 +356,7 @@ srv_distribution <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

setBookmarkExclude("params_reset")

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 @@ -313,7 +313,7 @@ srv_g_response <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(response = response, x = x, row_facet = row_facet, col_facet = col_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 @@ -494,7 +494,7 @@ srv_g_scatterplot <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(
x = x,
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 @@ -266,7 +266,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(variables = variables),
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 @@ -170,7 +170,7 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
Expand Down
2 changes: 1 addition & 1 deletion R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

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 @@ -241,7 +241,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(x = x, y = y),
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 @@ -201,7 +201,7 @@ srv_variable_browser <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
track_shiny_input_changes(input)
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

# if there are < this number of unique records then a numeric
# variable can be treated as a factor and all factors with < this groups
Expand Down
21 changes: 0 additions & 21 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,3 @@ assert_single_selection <- function(x,
}
invisible(TRUE)
}


track_shiny_input_changes <- function(input) {
if (shiny::isRunning()) {
plot_nss <-
c(
"pca_plot", "myplot", "hist_plot", "qq_plot", "scatter_plot", "summary_plot", "combination_plot",
"by_subject_plot", "box_plot", "density_plot", "cum_density_plot", "variable_plot"
)

elements <- c("plot_modal_width", "flex_width", "plot_modal_height", "flex_height")

excluded_inputs <- unlist(lapply(plot_nss, paste, elements, sep = "-"))
logger::log_shiny_input_changes(
input,
level = logger::TRACE,
namespace = "teal.modules.general",
excluded_inputs = excluded_inputs
)
}
}

0 comments on commit 66cdd94

Please sign in to comment.