feedback {DIZtools} | R Documentation |
Function to feedback messages either to the user and/or to the console and to the logfile.
Description
This function provides the functionality to publish any kind of information to the user, the console and/or to the logfile. This might be a simple info, a warning or an error. The function can be used to select the output (console, ui, logfile). If no output is selected, the print_this string will be printed to the console and to logfile. One of these must be a string with length > 0: print_me, console, ui. Default parameters can be set using the function 'DIZtools::log_set_defaults'. This function uses 'logger' as package to log to the console. If you are new to this function, consider using 'logger' instead.
Usage
feedback(
print_this = NULL,
type = NULL,
ui = NULL,
console = NULL,
logfile = NULL,
logjs = NULL,
prefix = NULL,
suffix = NULL,
findme = NULL,
logfile_dir = NULL,
headless = NULL
)
Arguments
print_this |
(Optional, String, default: "") |
type |
(Optional, String, default: "Info") E.g. "Warning", "Error". Default: "Info" |
ui |
(Optional, Boolean/String, default: FALSE) If true, the message will also be printed to the user in form of a modal. Can also be a string. |
console |
(Optional, Boolean/String, default: TRUE) If true, the message will also be printed to the console as is. Can also be a string. |
logfile |
(Optional, Boolean, default: TRUE) If true (default) the print_this string will also be printed to the console. |
logjs |
(Optional, Boolean, default: FALSE) If true (default: false) the print_this string will also be printed to the javascript-console. This only makes sense, if the gui is active. |
prefix |
Prefix (Optional, String, default: "") This is useful if print_this is an array/list. Each entry will then be new row with this prefix. |
suffix |
Suffix (Optional, String, default: "") Same like prefix but at the end of each line. |
findme |
(Optional, String, default: "") Recommended with length 10. String to find the message in the code. E.g. 10-digit random hex from https://onlinetools.com/random/generate-random-hexadecimal-numbers |
logfile_dir |
(Optional, String, default: "tempdir()") The absolute path to folder where the logfile will be stored. |
headless |
(Optional, Boolean, default: TRUE) Indicating, if the function is run only in the console (headless = TRUE) or on a GUI frontend (headless = FALSE). |
Value
No return value, called for publishing a message.
See Also
https://daroczig.github.io/logger/
Examples
feedback(
print_this = "This is an error message you can provide",
type = "Error",
findme = "215bb3695c",
logfile_dir = tempdir(),
headless = TRUE
)