Skip to content
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

updating quiet messaging -- default option set to TRUE upon loading #78

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions R/hush.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set an option to control whether messages and warning are suppressed.
# Defaults to verbose messaging.
options("matilda.verbose" = FALSE)
options(matilda.verbose = TRUE)

# Quiet messages

Expand All @@ -13,15 +13,15 @@ options("matilda.verbose" = FALSE)
matilda_message <- function(...) {

# Get the current verbose option setting
message.option <- getOption("matilda.verbose")
verbose <- getOption("matilda.verbose", default = TRUE)

# Check if the verbose option is set to FALSE
if (message.option == FALSE) {
# If FALSE, exit function without displaying message
return()
# Check if verbose
if (verbose) {
# If verbose, display a message
message(...)
}
# If verbose option is TRUE, display message
message(...)
# If verbose FALSE, return nothing
return()
}

# Quiet warnings
Expand All @@ -35,13 +35,13 @@ matilda_message <- function(...) {
matilda_warning <- function(...) {

# Get the current verbose option setting
warning.option <- getOption("matilda.verbose")
verbose <- getOption("matilda.verbose", default = TRUE)

# Check if the verbose option if set to FALSE
if (warning.option == FALSE) {
# If FALSE, exit the function without displaying message
return()
# Check if verbose
if (verbose) {
# If verbose, display warning
warning(...)
}
# If verbose option is TRUE, display message
warning(...)
# If verbose FALSE, return nothing
return()
}
Loading