Skip to contents

log_message() does not stop the execution of the script, regardless of the level of the message, and whether or not it prints to STDOUT or STDERR.

Usage

log_message(message, level = "INFO", out_or_err = "OUT")

Arguments

message

A string containing a message to log.

level

The level of the message (e.g. INFO, WARNING, ERROR), defaults to "INFO" but will accept any string.

out_or_err

Send log output to stdout or stderr, choices are "OUT" or "ERR" and the defaults is "OUT".

Value

A message printed to stdout or stderr.

Examples

log_message("This is an info message", "INFO", "OUT")
#> [2024-11-27 15:57:04.0633] INFO: This is an info message 
log_message("This is an error message", "ERROR", "ERR")
#> [2024-11-27 15:57:04.0642] ERROR: This is an error message
log_message("This is a warning message", "WARNING", "OUT")
#> [2024-11-27 15:57:04.0651] WARNING: This is a warning message