Description Usage Arguments Value Side Effects Examples
Log the start or end (either succesfully or not) of a job. Each job has a
name (for example update-prod-database
). Each unique run of a job is
identified by its (usually autogenerated id
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | job_start(
name,
status = 1L,
jobtype = 1L,
...,
id = ulid::generate(),
repeats = NULL,
path = NULL,
msg = NULL
)
job_finished(msg = NULL, id = last_job_id())
job_failed(msg = NULL, id = last_job_id())
last_job_id()
|
name |
|
status |
|
jobtype |
|
... |
added to the resulting |
id |
a global unique id (such as UUID or ULID) for the job |
repeats |
|
path |
|
msg |
|
job_start()
, job_finsihed()
, job_failed()
return a list()
that can be passed to Logger$list_log()
last_job_id()
returns the id (a character
scalar) of the last
job registered with job_start()
.
job_start()
assigns the variable .last_job_id
to the environment
joblog.globals
, which is used by job_finished()
and job_failed()
. If
you want to run several jobs concurrently, you need to pass id
in
manually.
1 2 3 4 5 6 7 8 9 | lg <- lgr::get_logger("test")
lg$list_log(job_start("update-database"))
lg$list_log(job_finished())
# run the job again the next day
lg$list_log(job_start("update-database"))
lg$list_log(job_failed("something went wrong this time"))
last_job_id()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.