Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- is_debug_mode <- function()
- {
- exists(".DEBUG", envir = globalenv()) &&
- get(".DEBUG", envir = globalenv())
- }
- set_debug_mode <- function(on = FALSE)
- {
- old_value <- is.debug.mode()
- .DEBUG <<- on
- invisible(old_value)
- }
- if(is_debug_mode())
- {
- #do some logging or whatever
- }
- set_debug_mode(TRUE) #turn debug mode on
- set_debug_mode(FALSE) #turn debug mode off
Add Comment
Please, Sign In to add comment