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.
log_warning(msg = NULL)log_error to write an error message to the log.
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/RtmpORwY5l/log/test.log
#> Working Directory: /cluster-data/user-homes/elizabethb/projects/prism-pkgdocs-build/installed-pkgs/priority-3/logr_1.3.9/docs/reference
#> User Name: elizabethb
#> R Version: 4.4.1 (2024-06-14)
#> Machine: uat-uat-a2ai-cloud x86_64
#> Operating System: Linux 6.2.0-1018-aws #18~22.04.1-Ubuntu SMP Wed Jan 10 22:54:16 UTC 2024
#> Base Packages: stats graphics grDevices utils datasets methods base
#> Other Packages: logr_1.3.9 common_1.1.3
#> Log Start Time: 2025-10-14 20:31:07.192102
#> =========================================================================
#>
#> Warning: Here is a warning
#>
#> NOTE: Log Print Time: 2025-10-14 20:31:07.193951
#> NOTE: Elapsed Time: 0.00129795074462891 secs
#>
#> =========================================================================
#> Log End Time: 2025-10-14 20:31:07.195779
#> Log Elapsed Time: 0 00:00:00
#> =========================================================================