bdpar.log {bdpar} | R Documentation |
Write messages to the log at a given priority level using the custom bdpar log
Description
bdpar.log
is responsible for managing the messages to
show on the log.
Usage
bdpar.log(message, level = "INFO", className = NULL, methodName = NULL)
Arguments
message |
A string to be printed to the log with the corresponding priority level. |
level |
The desired priority level (DEBUG,INFO,WARN,ERROR and FATAL). In the case of the FATAL level will be call to the stop function. Also, if the level is WARN, the message will be a warning. |
className |
A string to indicated in which class is called to the log. If the value is NULL, this field is not shown in the log. |
methodName |
A string to indicated in which method is called to the log. If the value is NULL, this field is not shown in the log. |
Details
The format output is as following:
[currentTime][className][methodName][level] message
The type of message changes according to the level indicated:
- The DEBUG,INFO and ERROR levels return a text
using the message
function.
- The WARN level returns a text using the warning
function.
- The FATAL level returns a text using the stop
function.
Note
In the case of multithreading, the log will only be by file.
See Also
Examples
## Not run:
# First step, configure the behavior of log
bdpar.options$configureLog(console = TRUE, threshold = "DEBUG", file = NULL)
message <- "Message example"
className <- "Class name example"
methodName <- "Method name example"
bdpar.log(message = message, level = "DEBUG", className = NULL, methodName = NULL)
bdpar.log(message = message, level = "INFO", className = className, methodName = methodName)
bdpar.log(message = message, level = "WARN", className = className, methodName = NULL)
bdpar.log(message = message, level = "ERROR", className = NULL, methodName = NULL)
bdpar.log(message = message, level = "FATAL", className = NULL, methodName = methodName)
## End(Not run)