add_journal_new.Rd
If the parameter 'journal' is missing, add_journal_new
creates an
empty journal (a data.frame with the expected format). The data.frame have
5 columns: 'task', 'status', 'start', 'end' and 'elapsed'.
If the parameter 'task' is not missing, add_journal_new
adds a new
line to journal, and sets 'start' to current time, 'task' to given 'task'.
If the parameter 'status' is not missing, add_journal_new
sets
information to either the last task in journal of the one correspding to
'id', that is meant to be the line number of journal. It sets 'status' to
given 'status', 'end' to current time. 'elapsed' to the formatted difftime
between 'end' and 'start'.
If verbose = TRUE, a message is sent. If 'task' is given, a new line is sent, but not ended by 'EOL'. When 'status' is given, message depend on what was sent just before. If the last message was announcing the start of the current task, it is completed with status and elapsed time. If not, a new line is sent with the whole information (start, task, status, elapsed).
add_journal_new(journal, task, status, id, verbose = TRUE)
data.frame, journal to be amended. May be missing (see details).
character, description of the task. May be missing (see details).
character, description of how the task has been performed. May be missing (see details).
integer, row of the task to be amended. May be missing (see details).
logical, should a message be sent. Default to TRUE.
a data frame of journal information.
add_journal_new()
#> [1] task status start end elapsed
#> <0 rows> (or 0-length row.names)
add_journal_new(status = "Nothing to be done...", verbose = FALSE)
#> Warning: Trying to add status information to an empty journal.
#> [1] task status start end elapsed
#> <0 rows> (or 0-length row.names)
{
journal = add_journal_new(
task = sprintf(
"maintain gaspar with floodam.data (%s)",
packageVersion("floodam.data")
)
)
Sys.sleep(10)
journal = add_journal_new(journal, task = "download_gaspar")
journal = add_journal_new(journal, task = "adapt_gaspar")
Sys.sleep(10)
journal = add_journal_new(journal, task = "alert_gaspar")
journal = add_journal_new(journal, status = "Done", id = 2)
Sys.sleep(10)
journal = add_journal_new(journal, status = "Done", id = 3)
journal = add_journal_new(journal, status = "Done")
journal = add_journal_new(journal, status = "Done", id = 1)
journal
}
#> 2023-02-03 11:54:31: [1] maintain gaspar with floodam.data (0.9.34.1)...
#>
#> 2023-02-03 11:54:41: [2] download_gaspar...
#>
#> 2023-02-03 11:54:41: [3] adapt_gaspar...
#>
#> 2023-02-03 11:54:51: [4] alert_gaspar...
#>
#> 2023-02-03 11:54:41: [2] download_gaspar... Done (00:00:00:10.01)
#> 2023-02-03 11:54:41: [3] adapt_gaspar... Done (00:00:00:20.03)
#> 2023-02-03 11:54:51: [4] alert_gaspar... Done (00:00:00:10.02)
#> 2023-02-03 11:54:31: [1] maintain gaspar with floodam.data (0.9.34.1)... Done (00:00:00:30.05)
#> start end
#> 1 2023-02-03 11:54:31 2023-02-03 11:55:01
#> 2 2023-02-03 11:54:41 2023-02-03 11:54:51
#> 3 2023-02-03 11:54:41 2023-02-03 11:55:01
#> 4 2023-02-03 11:54:51 2023-02-03 11:55:01
#> task status elapsed
#> 1 maintain gaspar with floodam.data (0.9.34.1) Done 00:00:00:30.05
#> 2 download_gaspar Done 00:00:00:10.01
#> 3 adapt_gaspar Done 00:00:00:20.03
#> 4 alert_gaspar Done 00:00:00:10.02