1
0
mirror of https://github.com/andre-wojtowicz/r-distributed-computing synced 2024-07-22 07:35:31 +02:00
r-distributed-computing/utils.R

28 lines
534 B
R
Raw Normal View History

2016-11-08 13:49:28 +01:00
# additional functions
setup.logger = function(output.file, overwrite.existing.files)
{
if (overwrite.existing.files & file.exists(output.file))
{
file.remove(output.file)
}
invisible(flog.appender(appender.tee(output.file)))
}
stop.script = function(error)
{
if (is.character(error))
{
flog.error(error)
} else if ("message" %in% attributes(x)$names) {
flog.error(error$message)
2016-11-08 13:49:28 +01:00
} else {
try(flog.error(getMessage(error)), silent = TRUE)
2016-11-08 13:49:28 +01:00
}
throw(error)
}