mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
Minimize str usage in rlog$valueStr (#2377)
* return early if loggin is disabled * do not allow str to recurse * add news item for #2377 * change " " to " " * Not a "world-ending performance issue"
This commit is contained in:
committed by
Joe Cheng
parent
f6e8e645f2
commit
a287ebe324
@@ -200,8 +200,13 @@ RLog <- R6Class(
|
||||
},
|
||||
|
||||
valueStr = function(value, n = 200) {
|
||||
if (!self$isLogging()) {
|
||||
# return a placeholder string to avoid calling str
|
||||
return("<reactlog is turned off>")
|
||||
}
|
||||
output <- try(silent = TRUE, {
|
||||
utils::capture.output(utils::str(value))
|
||||
# only capture the first level of the object
|
||||
utils::capture.output(utils::str(value, max.level = 1))
|
||||
})
|
||||
outputTxt <- paste0(output, collapse="\n")
|
||||
msg$shortenString(outputTxt, n = n)
|
||||
|
||||
Reference in New Issue
Block a user