Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion R/rollbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ rollbar.attach <- function() {
#' @param access_token Access token from your Rollbar project
#' @param env Environment name. Any string up to 255 chars is OK. For best results, use "production" for your production environment.
#' @param root Absolute path to the root of your application, not including the final /
#' @param scope A list with the current context data. This will be merged into the extra of any call to rollbar
#' @export
rollbar.configure <- function(access_token = NULL, env = NULL, root = NULL) {
rollbar.configure <- function(access_token = NULL, env = NULL, root = NULL, scope = NULL) {
if (!missing(access_token)) {
access_token <<- access_token
}
Expand All @@ -34,6 +35,9 @@ rollbar.configure <- function(access_token = NULL, env = NULL, root = NULL) {
if (!missing(root)) {
root <<- root
}
if (!missing(scope)) {
scope <<- scope
}
}

#' Report critical errors
Expand Down Expand Up @@ -117,6 +121,9 @@ rollbar.log <- function(level, message, extra = NULL) {
}

msg <- list(body = message)
if (exists("scope")) {
extra <- c(extra, scope)
}
if (!is.null(extra)) {
msg$extra <- extra
}
Expand Down