severeifnot: Logger message if conditions are not met

Description Usage Arguments Details Value Examples

View source: R/logifnot.R

Description

Similar to base::stopifnot, but allows you to use a custom message and logger level. If all conditions are TRUE, silently exit.

Usage

1
2
3
4
5
6
7
8
9

Arguments

msg

Logger message to write, as a single character string.

...

Conditions to evaluate

Details

Conditions can be vectorized, or can return non-logical values.The underlying function automatically applies isTRUE(all(.)) to the conditions.

Value

Invisibly, TRUE if conditions are met, FALSE otherwise

Examples

1
2
3
4
5
6
7
8
9
a <- 1:5
b <- list(6, 7, 8)
debugifnot("By the way, something is not a list.", is.list(a), is.list(b))
infoifnot("Something is not a list.", is.list(a), is.list(b))
warnifnot("I would prefer it if you used lists.", is.list(a), is.list(b))
errorifnot("You should definitely use lists.", is.list(a), is.list(b))
try({
  severeifnot("I absolutely cannot deal with the fact that something is not a list.", is.list(a), is.list(b))
})

infotroph/PEcAn.logger documentation built on May 23, 2019, 1:09 p.m.