lg <- get_logger("test")
# temporarily disable logging
lg$fatal("foo")
without_logging({
lg$info("everything in this codeblock will be suppressed")
lg$fatal("bar")
})
# globally disable logging
suspend_logging()
lg$fatal("bar")
with_logging(lg$fatal("foo")) # log anyways
# globally enable logging again
unsuspend_logging()
lg$fatal("foo")
Run the code above in your browser using DataLab