save_log | R Documentation |
Reads the log file, identifies error messages and sends an email with the status for running the main script. The log file can be saved with the current date last in file name.
save_log(
log_file,
log_path,
save = TRUE,
archive = NULL,
email = TRUE,
from = NULL,
to = NULL,
email_subject = tools::file_path_sans_ext(log_file),
include_text = NULL,
attach_object = NULL,
smtp_server = NULL,
...
)
log_file |
[ |
log_path |
[ |
save |
[ |
archive |
[ |
email |
[ |
from |
[ |
to |
[ |
email_subject |
[ |
include_text |
[ |
attach_object |
[ |
smtp_server |
[ |
... |
Other arguments to be passed to |
The function collects warnings and error messages from log file when a script has been run. The script must be set up to produce the log file. There the name and path of the log file will have been given.
The log file will be renamed so that the current date in the format "yyyymmdd" is included last in the file name before the file extension. This file should be permanently saved in an archive directory for example a subdirectory named "batchlog".
If an email should report the status, an email is produced. The subject of the email indicates whether the script run without problems or if warnings or error messages were produced. The log file is attached the email. If there are warnings or error messages, these are written in the email text.
It is possible include an short message first in the email text
by giving it as input to the argument include_text
. Such
a message can give more information of the status of running the
script. Such a message can be produced by the script and saved.
Thereafter, the message can be fetched and be used as input to
include_text
.
None. Saves the log after a script has been run and reports the error and warnings written in the log.
Petter Hopp Petter.Hopp@vetinst.no
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.