Skip to contents

Writes a warning message to the log. Warning will be written both to the log at the point the function is called, and also written to the message file. This function is used internally.

Usage

log_warning(msg = NULL)

Arguments

msg

The message to log.

See also

log_error to write an error 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")
#> Warning: Here is a warning 

# Close log
log_close()

# View results
writeLines(readLines(lf))
#> ========================================================================= 
#> Log Path: /tmp/RtmpI4bEze/log/test.log 
#> Working Directory: /tmp/.tmpGy5KKX/docs/logr/1.4.1/src/docs/reference 
#> User Name: runner 
#> R Version: 4.6.2 (2026-10-29) 
#> Machine: runnervm48cm3 x86_64 
#> Operating System: Linux 7.0.0-1017-azure #17~24.04.1-Ubuntu SMP PREEMPT Thu Sep 24 18:46:57 UTC 2026 
#> Base Packages: stats graphics grDevices utils datasets methods base 
#> Other Packages: logr_1.4.1 common_1.1.5 
#> Log Start Time: 2026-10-29 23:27:02.657157 
#> ========================================================================= 
#> 
#> Warning: Here is a warning 
#> 
#> NOTE: Log Print Time:  2026-10-29 23:27:02.659059 
#> NOTE: Elapsed Time: 0.00141572952270508 secs 
#> 
#> ========================================================================= 
#> Log End Time: 2026-10-29 23:27:02.661224 
#> Log Elapsed Time: 0 00:00:00 
#> =========================================================================