| Title: | Echo Code Evaluations |
| Version: | 0.1.0 |
| Maintainer: | Jordan Mark Barbone <jmbarbone@gmail.com> |
| Description: | Capture code evaluations and script executions by expressions, outputs, and condition calls for logging. |
| License: | MIT + file LICENSE |
| Depends: | R (≥ 3.6) |
| Imports: | utils |
| Suggests: | covr, spelling, testthat (≥ 3.0.0) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| URL: | https://github.com/jmbarbone/echo, https://jmbarbone.github.io/echo/ |
| BugReports: | https://github.com/jmbarbone/echo/issues |
| Language: | en-US |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2023-05-22 15:04:53 UTC; jordan |
| Author: | Jordan Mark Barbone
|
| Repository: | CRAN |
| Date/Publication: | 2023-05-25 20:00:12 UTC |
echo: Echo Code Evaluations
Description
Capture code evaluations and script executions by expressions, outputs, and condition calls for logging.
Author(s)
Maintainer: Jordan Mark Barbone jmbarbone@gmail.com (ORCID) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/jmbarbone/echo/issues
Echo
Description
Echo expression or a file
Usage
echo(
expr,
log = echo_get_log(),
msg = echo_get_msg(),
level = echo_get_level(),
file = NULL
)
Arguments
expr |
Expression to evaluate; should be written with curly braces (see examples) |
log |
A connection or file name for outputs; defaults to |
msg |
Logical, if |
level |
Sets the echo level (see details); defaults to |
file |
File path to evaluate (like |
Details
Levels of output can be controlled with level:
0EXP: logs expressions that were evaluated1OUT: logs outputs from expressions2MSG: logs messages3WRN: logs warnings4ERR: logs errors
When set, all outputs at the level or below are run. Errors are always
logged as they will interrupt and stop the program.
Timestamps are printed in UTC by default. To control this, set the option
value, such as options(echo.timezone = "EST").
Value
Nothing, called for side-effects
Examples
# make sure to use braces for expr
echo(letters, level = 0) # bad
echo({letters}, level = 0) # good
try(echo(
expr = {
print(1 + 1)
Sys.sleep(2)
head(mtcars)
message(1)
warning(2)
stop(3)
},
level = 0
))
# Parse lines in a file instead
try(echo(file = system.file("example-script.R", package = "echo")))
# Note that
x <- c("example for", "writing lines")
echo({
x
print(x)
writeLines(x)
}, level = 0)