Skip to contents

Capture message, warnings and errors from a R function

Usage

capture_log1(f)

Arguments

f

Function to gather the logs from.

Value

List of logs.

Examples

#' @examples
#' test_message <- function(a) {
#'   message("this is test from function message.")
#'   return(a)
#' }
#'
#' test_warning <- function(a) {
#'   warning("this is test from function warning.")
#'   return(a)
#' }
#'
#' test_error <- function(a) {
#'   stop("this is test from function error.")
#'   return(a)
#' }
#'
#' capture_log1(test_message)(1)
#'
#' capture_log1(test_warning)(1)
#'
#' capture_log1(test_error)(1)