To be used for logging at application level (i.e. when a shiny session is started) or at report level (i.e. each time a report is run). Logging of single report events should be made from reactive environments within the shiny server function or from within the (report) functions used by the same reactive environments.
appLogger(
session,
msg = "No message provided",
.topcall = sys.call(-1),
.topenv = parent.frame()
)repLogger(
session,
msg = "No message provided",
.topcall = sys.call(-1),
.topenv = parent.frame()
)
autLogger(
user,
name,
registryName,
reshId,
type,
pkg,
fun,
param,
msg = "No message provided",
.topenv = parent.frame()
)
Returns nothing but calls a logging appender
Shiny session object to be used for getting user data.
For testing and development purposes session
can be replaced by
list()
in which case various config options might be used to provide
something sensible.
String providing a user defined message to be added to the log record. Default value is 'No message provided'.
Parent call (if any) calling this function. Used to provide
the function call with arguments. Default value is sys.call(-1)
.
Name of the parent environment calling this function. Used to
provide package name (i.e. register) this function was called from.
Default value is parent.frame()
.
String providing owner of an automated report. Its value should correspond to the actual user name as provided in a shiny session at Rapporteket. Only used for subscription reports that are run outside a shiny session.
String providing full name of the report owner. Only used for automated reports that are run outside a shiny session.
String providing registry name. Only used for automated reports that are run outside a shiny session.
String providing the organization id of the (subscription) report author. Only used for automated reports that are run outside a shiny session.
Character string defining the type of report. Only used for
automated reports that are run outside a shiny session in which case its
value will replace that of .topcall
.
Character string naming the package of the function that is to be logged. Only used for automated reports that are run outside a shiny session.
Character string naming the function that should be logged. Only used for automated reports that are run outside a shiny session.
List of named function parameter. Only used for automated reports that are run outside a shiny session.
The below fields will be appended to the log, in the following order:
time
: date-time as event is logged as
format(time, "%Y-%m-%d %H:%M:%S")
user
: username as found in the shiny session object or as
provided by function argument
name
: full name of user as found in the shiny session object
group
: users group membership as provided by the shiny
session object. Normally, this will correspond to the registry the user
belongs to
role
: users role as provided by the shiny session object. Its
value will depend on whatever is delivered by the authorization provider,
but for OpenQReg registries 'LU' (local user) and 'SC' (system
coordinator) are typical values
resh_id
: the organization id of the current user as provided
by the shiny session object, OR, when source of logging is auto reports,
the organization ID of the data source used to make the report
environment
: environment from where the logger function was
called (only provided by repLogger()
)
call
: function (with arguments) from where the logger was
called (only provided by repLogger()
)
message: an optional message defined as argument to the function
The autLogger()
function is a special case to be used for automated
reports. Since such reports are run outside a reactive (shiny) context
shiny session data are not available to the logger. Hence, logging data
must be provided as arguments directly. As of rapbase version 1.12.0 logging
of automated reports are already taken care of. Hence, this function should
not be applied per registry application.
# \donttest{
# Depend on the environment variable R_RAP_CONFIG_PATH being set
try(appLogger(list()))
# }
# \donttest{
# Depend on the environment variable R_RAP_CONFIG_PATH being set
try(repLogger(list()))
# }
# \donttest{
# Depend on the environment variable R_RAP_CONFIG_PATH being set
try(autLogger(user = "ttester", registryName = "rapbase", reshId = "999999"))
# }
Run the code above in your browser using DataLab