Add the default e-mail logger
addDefaultEmailLogger(
mailSettings,
label = Sys.info()["nodename"],
name = "DEFAULT_EMAIL_LOGGER",
test = FALSE
)
Arguments to be passed to the send.mail function in the mailR package (except subject and body).
A label to be used in the e-mail subject to identify a run. By default the name of the computer is used.
A name for the logger.
If TRUE, a message will be displayed on the console instead of sending an e-mail.
Creates a logger that writes to e-mail using the "FATAL" threshold and the
layoutEmail
layout. This function uses the mailR
package. Please make sure
your e-mail settings are correct by using the mailR package before using those settings here.
ParallelLogger will not display any messages if something goes wrong when sending the e-mail.
mailSettings <- list(
from = "someone@gmail.com",
to = c("someone_else@gmail.com"),
smtp = list(
host.name = "smtp.gmail.com",
port = 465,
user.name = "someone@gmail.com",
passwd = "super_secret!",
ssl = TRUE
),
authenticate = TRUE,
send = TRUE
)
# Setting test to TRUE in this example so we don't really send an e-mail:
addDefaultEmailLogger(mailSettings, "My R session", test = TRUE)
logFatal("Something bad")
#> You've got mail:
#> To:
#> someone_else@gmail.com
#>
#> Subject:
#> [My R session] FATAL
#>
#> Body:
#> Message: Something bad
#> Time: 2023-06-27 11:18:34
#> Level: FATAL
#> Stack trace:
#> 41: logFatal("Something bad")
#> 40: eval(expr, envir, enclos)
#> 39: eval(expr, envir, enclos)
#> 38: eval_with_user_handlers(expr, envir, enclos, user_handlers)
#> 37: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
#> 36: withCallingHandlers(withVisible(eval_with_user_handlers(expr, envir, enclos
#> 35: doTryCatch(return(expr), name, parentenv, handler)
#> 34: tryCatchOne(expr, names, parentenv, handlers[[1]])
#> 33: tryCatchList(expr, classes, parentenv, handlers)
#> 32: tryCatch(expr, error = function(e) {
#> call <- conditionCall(e)
#> if (!is
#> 31: try(f, silent = TRUE)
#> 30: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,
#> 29: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handl
#> 28: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, debug
#> 27: evaluate::evaluate(code, child_env(env), new_device = TRUE, output_handler
#> 26: downlit::evaluate_and_highlight(code, fig_save = fig_save_topic, env = chil
#> 25: highlight_examples(code, topic, env = env)
#> 24: run_examples(tags$tag_examples[[1]], env = if (is.null(examples_env)) NULL
#> 23: data_reference_topic(topic, pkg, examples_env = examples_env, run_dont_run
#> 22: withCallingHandlers(data_reference_topic(topic, pkg, examples_env = example
#> 21: .f(.x[[i]], ...)
#> 20: call_with_cleanup(map_impl, environment(), .type, .progress, n, names, i)
#> 19: withCallingHandlers(expr, error = function(cnd) {
#> if (i == 0) {
#> }
#>
#> 18: with_indexed_errors(i = i, names = names, error_call = .purrr_error_call, c
#> 17: map_("list", .x, .f, ..., .progress = .progress)
#> 16: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, examples_
#> 15: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_d
#> 14: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_ru
#> 13: pkgdown::build_site(...)
#> 12: (function (..., cli_colors, pkgdown_internet)
#> {
#> options(cli.num_colors =
#> 11: (function (what, args, quote = FALSE, envir = parent.frame())
#> {
#> if (!is.
#> 10: do.call(do.call, c(readRDS("C:\\Users\\mschuemi\\AppData\\Local\\Temp\\2\\R
#> 9: saveRDS(do.call(do.call, c(readRDS("C:\\Users\\mschuemi\\AppData\\Local\\Te
#> 8: withCallingHandlers({
#> NULL
#> saveRDS(do.call(do.call, c(readRDS("C:\\Us
#> 7: doTryCatch(return(expr), name, parentenv, handler)
#> 6: tryCatchOne(expr, names, parentenv, handlers[[1]])
#> 5: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
#> 4: doTryCatch(return(expr), name, parentenv, handler)
#> 3: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names
#> 2: tryCatchList(expr, classes, parentenv, handlers)
#> 1: tryCatch(withCallingHandlers({
#> NULL
#> saveRDS(do.call(do.call, c(readRD
unregisterLogger("DEFAULT_EMAIL_LOGGER")
#> [1] TRUE