with_log_threshold: Evaluate R expression with a temporarily updated log level...

Description Usage Arguments Examples

View source: R/logger.R

Description

Evaluate R expression with a temporarily updated log level threshold

Usage

1
2
3
4
5
6
with_log_threshold(
  expression,
  threshold = ERROR,
  namespace = "global",
  index = 1
)

Arguments

expression

R command

threshold

log_levels

namespace

logger namespace

index

index of the logger within the namespace

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
log_threshold(TRACE)
log_trace('Logging everything!')
x <- with_log_threshold({
  log_info('Now we are temporarily suppressing eg INFO messages')
  log_warn('WARN')
  log_debug('Debug messages are suppressed as well')
  log_error('ERROR')
  invisible(42)
}, threshold = WARN)
x
log_trace('DONE')

## End(Not run)

logger documentation built on July 6, 2021, 5:07 p.m.