Survey Logger Class
survey_logger.Rd
R6 Class providing queued logging functionality for Shiny survey applications using the main application's database connection pool.
Details
The logger uses a queue-based approach where messages are:
Added to an in-memory queue immediately
Displayed in the console (if not suppressed)
Periodically processed and written to the database in batches
Features:
Uses main application pool for database operations
Efficient batch database writes
Immediate console feedback with color coding
Connection pool health monitoring
Message Types
INFO
: Regular informational messages (green)WARN
: Warning messages (yellow)ERROR
: Error messages (red)
Public fields
log_table
Character string specifying the PostgreSQL table for logs
session_id
Character string containing unique session identifier
survey_name
Character string identifying the current survey
suppress_logs
Logical flag to suppress console output
queue
data.frame containing queued messages for batch processing
Methods
Method new()
Initialize a new survey logger instance
Usage
survey_logger$new(log_table, session_id, survey_name, suppress_logs = FALSE)
Method log_message()
Queue a message for logging and display in console