-
Notifications
You must be signed in to change notification settings - Fork 0
Ensure docs are complete and correct with respect to SEVERE vs ERROR #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0427e3
806e257
efaace8
3eda26b
6e8d0ee
af80836
41bdc08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,9 +81,8 @@ logger.error <- function(msg, ...) { | |
| ##' This function will print a message and stop execution of the code. This | ||
| ##' should only be used if the application should terminate. | ||
| ##' | ||
| ##' set \code{\link{logger.setQuitOnSevere}(FALSE)} to avoid terminating | ||
| ##' the session. This is set by default to TRUE if interactive or running | ||
| ##' inside Rstudio. | ||
| ##' Set \code{\link{logger.setQuitOnSevere}(FALSE)} to avoid terminating | ||
| ##' the session. The default is to not quit if running interactively. | ||
| ##' | ||
| ##' @param msg the message that should be printed. | ||
| ##' @param ... any additional text that should be printed. | ||
|
|
@@ -173,16 +172,28 @@ logger.message <- function(level, msg, ..., wrap = TRUE) { | |
| ##' Configure logging level. | ||
| ##' | ||
| ##' This will configure the logger level. This allows to turn DEBUG, INFO, | ||
| ##' WARN and ERROR messages on and off. | ||
| ##' WARN, ERROR, and SEVERE messages on and off. | ||
| ##' | ||
| ##' Note that this controls _printing_ of messages and does not change other behavior. | ||
| ##' In particular, suppressing SEVERE by setting the level to "OFF" does not prevent | ||
| ##' logger.severe() from signaling an error (and terminating the program if | ||
| ##' `logger.setQuitOnSevere(TRUE)`). | ||
| ##' | ||
| ##' @param level the level of the message. One of "ALL", "DEBUG", "INFO", "WARN", | ||
| ##' "ERROR", "SEVERE", or "OFF". | ||
| ##' | ||
| ##' @param level the level of the message (ALL, DEBUG, INFO, WARN, ERROR, OFF) | ||
| ##' @export | ||
| ##' @return When logger level is set, the previous level is returned invisibly. | ||
| ##' This can be passed to `logger.setLevel()` to restore the previous level. | ||
| ##' @author Rob Kooper | ||
| ##' @examples | ||
| ##' \dontrun{ | ||
| ##' logger.setLevel('DEBUG') | ||
| ##' | ||
| ##' # Temporarily turn logger off | ||
| ##' old_logger_level <- logger.setLevel("OFF") | ||
| ##' # code here | ||
| ##' logger.setLevel(old_logger_level) | ||
| ##' } | ||
| logger.setLevel <- function(level) { | ||
| original_level <- logger.getLevel() | ||
|
|
@@ -193,14 +204,22 @@ logger.setLevel <- function(level) { | |
|
|
||
|
|
||
| ## Given the string representation this will return the numeric value | ||
| ## DEBUG = 10 | ||
| ## INFO = 20 | ||
| ## WARN = 30 | ||
| ## ERROR = 40 | ||
| ## ALL = 99 | ||
| ## | ||
| ##@return level the level of the message | ||
| ##@author Rob Kooper | ||
| ## Supported levels | ||
| ## ALL = 0 | ||
| ## DEBUG = 10 | ||
| ## INFO = 20 | ||
| ## WARN = 30 | ||
| ## ERROR = 40 | ||
| ## SEVERE = 50 | ||
| ## OFF = 60 | ||
| ## | ||
| ## SEVERE is treated as more serious than ERROR, | ||
| ## and will terminate the session if `logger.setQuitOnSevere(TRUE)` | ||
dlebauer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## or call stop() otherwise | ||
| ## | ||
| ## @return level the level of the message | ||
| ## @author Rob Kooper | ||
| logger.getLevelNumber <- function(level) { | ||
| if (toupper(level) == "ALL") { | ||
| return(0) | ||
|
|
@@ -213,7 +232,7 @@ logger.getLevelNumber <- function(level) { | |
| } else if (toupper(level) == "ERROR") { | ||
| return(40) | ||
| } else if (toupper(level) == "SEVERE") { | ||
| return(40) | ||
| return(50) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| } else if (toupper(level) == "OFF") { | ||
| return(60) | ||
| } else { | ||
|
|
@@ -225,9 +244,14 @@ logger.getLevelNumber <- function(level) { | |
|
|
||
| ##' Get configured logging level. | ||
| ##' | ||
| ##' This will return the current level configured of the logging messages | ||
| ##' This will return the current level configured of the logging messages. | ||
| ##' | ||
| ##' Note that `logger.setLevel()` invisibly returns current level, so | ||
| ##' `logger.getLevel()` is not required to restore the level after a | ||
| ##' temporary change. | ||
| ##' | ||
| ##' @return level the level of the message (ALL, DEBUG, INFO, WARN, ERROR, OFF) | ||
| ##' @return A string giving the lowest message level that will be reported, one of | ||
| ##' "ALL", "DEBUG", "INFO", "WARN", "ERROR", "SEVERE", or "OFF". | ||
| ##' @export | ||
| ##' @author Rob Kooper | ||
| ##' @examples | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.