diff --git a/DESCRIPTION b/DESCRIPTION index ee3f687e4..fef8364a7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,6 +42,7 @@ Imports: htmlwidgets, jsonlite, lattice, + logger, MASS, methods, rlang, @@ -66,7 +67,7 @@ Suggests: scda(>= 0.1.1), test.nest (>= 0.2.11), testthat (>= 2.0) -VignetteBuilder: +VignetteBuilder: knitr Encoding: UTF-8 LazyData: true diff --git a/NEWS.md b/NEWS.md index 2a4bd1d7a..aca622802 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,9 @@ * Used browser-side processing in `tm_data_table` so that `Buttons` extension could download full table. Added example for advanced usage of `DT` in the module. * Fixed an error in `tm_variable_browser` when the selected column is `logical(1)`. +## Enhancements +* Added support for logging with the `logger` package and added info level logs upon initialization of a module. + # teal.modules.general 0.2.11 ### New features diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 493165715..2642567d1 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -61,7 +61,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") stopifnot(is_character_single(label)) stopifnot(is_class_list("data_extract_spec")(dat) || is(dat, "data_extract_spec")) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 1345a7610..18db36a44 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -82,6 +82,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") if (!is_class_list("data_extract_spec")(regressor)) { regressor <- list(regressor) } diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 052079da0..4b8551808 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -140,6 +140,7 @@ tm_data_table <- function(label = "Data Table", scrollX = TRUE), pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_data_table") stop_if_not( is_character_single(label), is.list(variables_selected), @@ -340,8 +341,6 @@ srv_data_table <- function(input, validate(need(variables, "need valid variable names")) - .log("data table update", dataname) - df <- datasets$get_data( dataname, filtered = if_filtered() diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index 31c836914..cf4101b7a 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -35,7 +35,7 @@ #' tm_file_viewer <- function(label = "File Viewer Module", input_path = list("Current Working Directory" = ".")) { - + logger::log_info("Initializing tm_file_viewer") if (is.null(label) || length(label) == 0 || label == "") { label <- " " } diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 6436fda54..7c3bcee2e 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -76,6 +76,7 @@ tm_g_association <- function(label = "Association", association_theme = gg_themes, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_g_association") if (!is_class_list("data_extract_spec")(ref)) { ref <- list(ref) } diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 07e1e3ac6..f5f32e448 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -102,7 +102,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots", ggtheme = gg_themes, pre_output = NULL, post_output = NULL) { - + logger::log_info("Initializing tm_g_bivariate") ggtheme <- match.arg(ggtheme) stop_if_not( diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index b88397368..0276b9ad9 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -93,7 +93,7 @@ tm_g_distribution <- function(label = "Distribution Module", plot_width = NULL, pre_output = NULL, post_output = NULL) { - + logger::log_info("Initializing tm_g_distribution") if (!is.null(dist_var) && !is_class_list("data_extract_spec")(dist_var)) { dist_var <- list(dist_var) } diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 11c03800f..a997b51cb 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -79,6 +79,7 @@ tm_g_response <- function(label = "Response Plot", ggtheme = gg_themes, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_g_response") if (!is_class_list("data_extract_spec")(response)) { response <- list(response) } diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 64ddab7c1..c7da7a124 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -133,6 +133,7 @@ tm_g_scatterplot <- function(label = "Scatterplot", pre_output = NULL, post_output = NULL, table_dec = 4) { + logger::log_info("Initializing tm_g_scatterplot") if (!is_class_list("data_extract_spec")(x)) { x <- list(x) } diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 3c019a931..07bb9614c 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -73,6 +73,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", plot_width = NULL, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_g_scatterplotmatrix") if (!is_class_list("data_extract_spec")(variables)) { variables <- list(variables) } diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 55cf0581c..91dca11ba 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -33,6 +33,7 @@ tm_missing_data <- function(label = "Missing data", plot_width = NULL, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_missing_data") stopifnot(is_character_single(label)) check_slider_input(plot_height, allow_null = FALSE) check_slider_input(plot_width) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index da5c5215d..0133f4673 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -63,6 +63,7 @@ tm_outliers <- function(label = "Outliers Module", plot_width = NULL, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_outliers") if (!is_class_list("data_extract_spec")(outlier_var)) { outlier_var <- list(outlier_var) } diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 87d365f4c..46d168e6f 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -73,6 +73,7 @@ tm_t_crosstable <- function(label = "Cross Table", show_total = TRUE, pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_t_crosstable") stop_if_not( is_character_single(label), is_class_list("data_extract_spec")(x) || is(x, "data_extract_spec"), diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 0cf70fee7..172d57cec 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -40,6 +40,7 @@ tm_variable_browser <- function(label = "Variable Browser", datasets_selected = character(0), pre_output = NULL, post_output = NULL) { + logger::log_info("Initializing tm_variable_browser") stop_if_not(is_character_single(label), is_character_empty(datasets_selected) || is_character_vector(datasets_selected) ) @@ -903,8 +904,6 @@ get_plotted_data <- function(input, plot_var, datasets) { type <- input$raw_or_filtered df <- datasets$get_data(dataset_name, filtered = type) - .log("plot/summarize variable", varname, "for data", dataset_name, "(", `if`(type, "filtered", "raw"), ")") - var_description <- get_var_description(datasets = datasets, dataset_name = dataset_name, var_name = varname) list(data = df[[varname]], var_description = var_description) } @@ -936,8 +935,6 @@ render_tabset_panel_content <- function(datanames, output, datasets, input, colu #' @param dataset_name (`character`) the name of the dataset contained in the rendered tab #' @inheritParams render_tabset_panel_content render_single_tab <- function(dataset_name, output, datasets, input, columns_names, plot_var) { - .log("variable label table:", dataset_name) - render_tab_header(dataset_name, output, datasets) render_tab_table( diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 000000000..333998cba --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,3 @@ +.onLoad <- function(libname, pkgname) { # nolint + teal::register_logger(namespace = "teal.modules.general") +}