Activities for displaying messages preceded by the simulation time and the name of the arrival, and for setting conditional breakpoints.
Arguments
- .trj
the trajectory object.
- message
the message to display, accepts either a string or a callable object (a function) which must return a string.
- level
debugging level. The
message
will be printed if, and only if, thelevel
provided is less or equal to thelog_level
defined in the simulation environment (seesimmer
).- ...
unused.
- tag
activity tag name to perform named rollbacks (see
rollback
) or just to better identify your activities.- condition
a boolean or a function returning a boolean.
Examples
## log levels
traj <- trajectory() %>%
log_("this is always printed") %>% # level = 0 by default
log_("this is printed if `log_level>=1`", level = 1) %>%
log_("this is printed if `log_level>=2`", level = 2)
simmer() %>%
add_generator("dummy", traj, at(0)) %>%
run() %>% invisible
#> 0: dummy0: this is always printed
simmer(log_level = 1) %>%
add_generator("dummy", traj, at(0)) %>%
run() %>% invisible
#> 0: dummy0: this is always printed
#> 0: dummy0: this is printed if `log_level>=1`
simmer(log_level = Inf) %>%
add_generator("dummy", traj, at(0)) %>%
run() %>% invisible
#> 0: dummy0: this is always printed
#> 0: dummy0: this is printed if `log_level>=1`
#> 0: dummy0: this is printed if `log_level>=2`