feat: replace logger with lightweight console logging + ZIP export#1212
Draft
Gero1999 wants to merge 30 commits into
Draft
feat: replace logger with lightweight console logging + ZIP export#1212Gero1999 wants to merge 30 commits into
Gero1999 wants to merge 30 commits into
Conversation
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
Log analyte, specimen, profile, method, min half-life points, and flag rule changes at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log the full list of selected parameters at DEBUG level alongside the existing INFO count message. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Upgrade slope rule add/remove from TRACE to INFO level. Add DEBUG summary of slope rules count on table changes. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log exclusion add (with row count, type, reason), removal, and settings restore at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log NCA profile changes, BLQ strategy changes, and C0 imputation toggle at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
This was referenced Apr 14, 2026
Replace all glue-style log calls ({var}) with paste-style
(multiple arguments) to avoid parent.frame(2) scoping issues
in closures and observeEvent callbacks. Guard profile log
against NA values.
Co-authored-by: Ona <no-reply@ona.com>
Log analyte, specimen, profile, method, min half-life points, and flag rule changes at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log the full list of selected parameters at DEBUG level alongside the existing INFO count message. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Upgrade slope rule add/remove from TRACE to INFO level. Add DEBUG summary of slope rules count on table changes. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log exclusion add (with row count, type, reason), removal, and settings restore at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log NCA profile changes, BLQ strategy changes, and C0 imputation toggle at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Replace all glue-style log calls ({var}) with paste-style
(multiple arguments) to avoid parent.frame(2) scoping issues
in closures and observeEvent callbacks. Guard profile log
against NA values.
Co-authored-by: Ona <no-reply@ona.com>
Include explanation of what the log captures, current threshold, visible levels, and a link to the full reference page. Closes #1220 (partial) Co-authored-by: Ona <no-reply@ona.com>
Developer website page documenting all logged events by workflow stage, log levels, and configuration via aNCA_LOG_LEVEL. Closes #1220 (partial) Co-authored-by: Ona <no-reply@ona.com>
Add 'Session Log Reference' entry under Developer Resources in the website navigation. Closes #1220 (partial) Co-authored-by: Ona <no-reply@ona.com>
Clarify what the log captures vs. what it does not, and link to the full session log reference page. Closes #1220 (partial) Co-authored-by: Ona <no-reply@ona.com>
…b.com/pharmaverse/aNCA into 1219-enhancement/nca-input-log-points
…ession-logs docs: document session log contents
Replace separate add/remove INFO messages with a single INFO summary that fires on any slope table change (button clicks, plotly point selections, cell edits). Demote add/remove to TRACE. Co-authored-by: Ona <no-reply@ona.com>
- Suppress analyte/specimen/profile logs during initial data load using a filters_initialized guard - Move profile log to dedicated observeEvent(input$select_profile) with ignoreInit = TRUE - Move exclusion-add logging inside .handle_add_exclusion to avoid duplicating input reads - Use 'selections' instead of 'inclusions' in slope log to match the UI terminology (TYPE == 'Selection') Co-authored-by: Ona <no-reply@ona.com>
- Convert remaining glue-style log calls to paste-style (parameter_selection.R log_info, manual_slopes_table.R log_trace) - Add filters_initialized guard to method and min_hl_points observers to suppress logs during settings restore Co-authored-by: Ona <no-reply@ona.com>
Add user_changed_slopes flag to only log slope rule changes triggered by user actions (plotly clicks, add/remove buttons), not by settings restore or initial render. Co-authored-by: Ona <no-reply@ona.com>
…log-points feat: add log-points for NCA user input changes
Resolve conflicts: - parameter_selection.R: keep both log-points and new clear_all observer - settings.R: keep filters_initialized guard with updated pending_settings pattern from #1227 - tab_tlg.R: whitespace-only, keep main's formatting Co-authored-by: Ona <no-reply@ona.com>
- Remove @importFrom logger log_info from imports-shiny.R and NAMESPACE (logger is no longer used, log_info is now in logging.R) - Remove logger from DESCRIPTION Suggests (no remaining references) - Remove dead observeEvent(study_types_list()) block from parameter_selection.R that referenced the old sub-module approach (param_selector_panel_server) which no longer exists in main - Replace with debounced observer on selections_state() compatible with main's matrix-based parameter selection UI - Update session_log.Rmd to remove DEBUG parameter list entry Co-authored-by: Ona <no-reply@ona.com>
Resolve general_exclusions.R conflict: main refactored inline remove observers into shared .register_remove_observers() helper, branch added log_info() calls. Resolution: use main's shared helper with a new on_remove callback parameter to preserve the branch's removal logging. Auto-merged: DESCRIPTION, utils-exclusions.R, pkgdown/_pkgdown.yml. Co-authored-by: Ona <no-reply@ona.com>
…g the log message to the current remote-tracking branch 'origin/main' into 1210-enhancement/replace-logger-with-console
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
Merges reviewed changes from:
What to review
Most of the diff comes from child PRs that were already reviewed and merged into this branch. The new code unique to this PR is:
inst/shiny/functions/logging.Rinst/shiny/functions/utils.Rsetup_logger()inst/shiny/modules/tab_nca/zip.Rsession_logadded toTREE_LIST$extrasinst/shiny/functions/zip-utils.R.export_session_log()functioninst/shiny/modules/tab_nca.Rsetup_logger()callDESCRIPTION/NAMESPACE/R/imports-shiny.Rloggerpackage removalEverything else in the diff is either from #1221 (log-points), #1222 (documentation), or merge commits from main.
Description
Replaces the
loggerpackage with a lightweight internal logging system. Log messages are written to the R console viamessage()and captured in an in-memory buffer that is exported assession_log.txtin the ZIP download.Core logging system
inst/shiny/functions/logging.Rwithlog_trace,log_debug,log_info,log_success,log_warn,log_errorget_log_buffer()) for ZIP exportaNCA_LOG_LEVELenv var (default: INFO)loggerfrom Imports and Suggests, removedsetup_logger()fromutils.RNCA input log-points (#1221 — already reviewed)
filters_initializedguardSession log documentation (#1222 — already reviewed)
session_log.txtincludes a header block explaining contents, threshold, and link to reference pagevignettes/session_log.Rmd— full reference of logged events by workflow stagelogging.RheaderZIP export
session_logadded toTREE_LIST$extras(available with or without NCA results).export_session_log()writes the buffer with header tosession_log.txtDefinition of Done
loggerpackage fully removed (no imports, no Suggests, norequire)log_*calls work with the new systemsession_log.txtexported in ZIP with explanatory headerHow to test
aNCA::run_app()session_log.txtis present with header and log entriesaNCA_LOG_LEVEL=TRACEand verify more verbose outputContributor checklist
.scsschange was done, rundata-raw/compile_css.RNotes to reviewer
The
loggerpackage is fully removed — not just from Imports but also from Suggests and NAMESPACE. The@importFrom logger log_infoinR/imports-shiny.Rhas been removed.The parameter selection logging was adapted to main's matrix-based UI (the old sub-module approach via
param_selector_panel_serverno longer exists).Version bump and NEWS entry still needed before merge.