This function logs the parameters and the call time of a specified function to a log file.
If any of the parameters are matrices or vectors longer than 5 elements, their values will not be printed in the log.
log_parameters(func, logfile, ...)
Arguments
- func
The function to be called and logged.
- logfile
The name of the log file where the function call information will be saved. The actual file will be named logfile_function_calls.log
.
- ...
Additional arguments to be passed to the function func
.
Value
The result of the function func
.
Examples
my_function <- function(a, b, c = 10) {
return(a + b + c)
}
result <- log_parameters(my_function, "my_log", a = 1, b = 2, c = 3)
print(result)
#> [1] 6