get_warnings: Gets warnings from most recent log

View source: R/logr.R

get_warningsR Documentation

Gets warnings from most recent log

Description

Returns a vector of warning messages from the most recent logging session. The function takes no parameters. The warning list will be cleared the next time log_open is called.

Usage

get_warnings()

See Also

log_warning to write a warning message to the log.

Examples

library(logr)

# Create temp file location
tmp <- file.path(tempdir(), "test.log")

# Open log
lf <- log_open(tmp)

# Send warning message to log
log_warning("Here is a warning")

# Close log
log_close()

# Retrieve warnings
res <- get_warnings()

# View results
res
# [1] "Warning: Here is a warning"

logr documentation built on April 4, 2025, 2:55 a.m.