Skip to content

Commit

Permalink
log: log all loaded packages on error
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Feb 25, 2025
1 parent 88cd75f commit 7c2dbf7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions R/log.R
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,28 @@ log_pkg_info <- function(pkg) {
}


#' Log all loaded packages
#'
#' @importFrom sessioninfo session_info
#' @importFrom dplyr mutate pull
#' @importFrom tibble as_tibble
#' @importFrom logger log_info
#' @importFrom magrittr %>% extract2
#' @noRd
log_packages <- function() {

session_info(info = 'packages') %>%
extract2('packages') %>%
as_tibble %>%
mutate(summary = sprintf('%s %s(%s)', package, loadedversion, date)) %>%
pull(summary) %>%
paste(collapse = '; ') %>%
log_info('Loaded packages: %s', .)


}


#' Log all info about package, platform, environment, libraries
#'
#' @importFrom logger log_info
Expand All @@ -498,6 +520,7 @@ log_all_info <- function(pkg) {

log_pkg_info(pkg)
log_session_info()
log_packages()
log_curl_info()

}
Expand Down

0 comments on commit 7c2dbf7

Please sign in to comment.