set_logging should be used outside ui and server functions, possibly in global.R, to be used only once to define where the logging should be done. Events can be sent to R console, browser JavaScript console, a eventlog file, or a database (or any combination of these). By default logging is done to the R console and JavaScript console. set_logging also can be used to define global event parameters - named objects passed to ... that will be evaluated and added to lists of parameters of all events.

set_logging(r_console = TRUE, js_console = TRUE, file = FALSE,
  database = FALSE, ...)

Arguments

r_console

A logical. Should events be logged into R console? Default is TRUE.

js_console

A logical. Should events be logged into browser JavaScript console? Default is TRUE.

file

A logical or a character string. Should events be logged to a file? Default is FALSE. If TRUE the default eventlog filename is "events.log". If character string, path and name of the filelog.

database

A logical or a character string. Should events be logged into a database? Default is FALSE. If TRUE or "mongoDB" the connection URL to the database will be read from the first line of a text file named ".db_url".

...

a set of named objects (usually of type character, numeric, or date) to be logged as parameters common to all events.

Details

set_logging assigns to the parent frame a new environment log_settings_global for storing global event parameters. If database = TRUE additional database connection object named log_db is assigned to the parent frame as well.

See also

Other setting up logging parameters functions: log_params, set_logging_session

Examples

if (interactive()) { set_logging(r_console = TRUE, js_console = FALSE, "param_1" = 1, "param_2" = "A") shiny::shinyApp( ui = shiny::fluidPage(), server = function(input, output) { set_logging_session() log_event("Event with global params") } ) }