chronicle
.Decorates a function to output objects of type chronicle
.
record(.f, .g = (function(x) NA), strict = 2, diff = "none")
A function which returns objects of type chronicle
. chronicle
objects carry several
elements: a value
which is the result of the function evaluated on its inputs and a second
object called log_df
. log_df
contains logging information, which can be read using
read_log()
. log_df
is a data frame with columns: outcome, function, arguments, message, start_time, end_time, run_time, g and diff_obj.
A function to decorate.
Optional. A function to apply to the intermediary results for monitoring purposes. Defaults to returning NA.
Controls if the decorated function should catch only errors (1), errors and warnings (2, the default) or errors, warnings and messages (3).
Whether to show the diff between the input and the output ("full"), just a summary of the diff ("summary"), or none ("none", the default)
To chain multiple decorated function, use bind_record()
or %>=%
.
If the diff
parameter is set to "full", diffobj::diffObj()
(or diffobj::summary(diffobj::diffObj()
, if diff is set to "summary")
gets used to provide the diff between the input and the output.
This diff can be found in the log_df
element of the result, and can be
viewed using check_diff()
.
record(sqrt)(10)
record(sqrt)(x = 10)
Run the code above in your browser using DataLab