feat: replace logger with lightweight console logging + ZIP export#1212
Draft
feat: replace logger with lightweight console logging + ZIP export#1212
Conversation
Move packages that are required for run_app() from Suggests to Imports
so they are installed automatically with install.packages('aNCA').
Moved to Imports: bslib, htmltools, htmlwidgets, logger,
reactable, reactable.extras, shiny, shinycssloaders, shinyjs,
shinyjqui, shinyWidgets, zip.
Removed stringi dependency entirely, replaced with base R
paste0(sample()) for random string generation.
Simplified check_app_dependencies() since all core app packages
are now guaranteed by Imports.
Co-authored-by: Ona <no-reply@ona.com>
later is always available when shiny is installed. No need to list it explicitly in DESCRIPTION. Co-authored-by: Ona <no-reply@ona.com>
Replace the logger package dependency with an internal logging system that outputs to the R console and captures logs in memory. The session log can be exported as session_log.txt in the ZIP download. - Add inst/shiny/functions/logging.R with log_trace/debug/info/success/ warn/error functions, glue interpolation, configurable threshold via aNCA_LOG_LEVEL env var, and in-memory buffer - Remove setup_logger and log_debug_list from utils.R (now in logging.R) - Remove require(logger) from app.R - Move logger from Imports back to Suggests in DESCRIPTION - Add session_log to ZIP export tree and file filtering Closes #1210 Co-authored-by: Ona <no-reply@ona.com>
Collaborator
|
With this, are there any contributing guidelines for what activity should be logged and what should not be? For reference for future function/feature implementation. |
Collaborator
Author
|
@bachapman good point Bryce, probably we can include something for this. Either add a website page for the log file and then add the link somewhere in the App. Perhaps would be also a good idea to put a help button in the Export modal message with all output explanations/links. |
Collaborator
Author
|
Or maybe is easier if we add commented lines at the top of the file to explain what is captured. Currently we are tracking this, the strategy is always to capture errors/warnings in the most data-sensitive points (mapping, NCA settings, NCA run):
|
…ace-logger-with-console
This was referenced Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #1210
Description
Replaces the
loggerpackage with a lightweight internal logging system. Log messages are printed to the R console and captured in memory so they can be exported assession_log.txtin the ZIP download.What changed:
inst/shiny/functions/logging.R— drop-in replacements forlog_trace,log_debug,log_info,log_success,log_warn,log_error, andlog_debug_list. Supports glue-style{var}interpolation and paste-style multi-argument calls. Threshold configurable viaaNCA_LOG_LEVELenv var (default:INFO).setup_logger()andlog_debug_list()fromutils.R(now inlogging.R).require(logger)fromapp.R.loggerfromImportsback toSuggestsinDESCRIPTION.session_logto the ZIP export tree — the in-memory log buffer is written tosession_log.txtalongsidesession_info.txt.What no longer happens:
./logdirectory). All output goes to the console and the in-memory buffer.Definition of Done
loggerinstalled.session_log.txtwith the session's log entries.How to test
logger(or test in a clean environment).aNCA::run_app()— should start without errors.session_log.txtis included with log entries.aNCA_LOG_LEVEL=TRACEin.Renvironand verify more verbose output.Contributor checklist
.scsschange was done, rundata-raw/compile_css.RNotes to reviewer
All 48 existing
log_*calls across the Shiny modules work unchanged — the new functions have the same signatures and support both glue interpolation (log_info(\"Processing {n} items\")) and paste-style (log_info(\"Processing: \", n, \" items\")).The
aNCA_LOG_LEVELenv var is still respected, same as before.Version bump and NEWS entry still needed before merge.