closelog: Close current logfile

View source: R/logging.R

closelogR Documentation

Close current logfile

Description

Close current logfile

Usage

closelog(sessionInfo = TRUE)

Arguments

sessionInfo

Append sessionInfo output? (logical, optional)

Details

Close current logfile. The number of flagged messages is returned, invisibly. Note that if options(luzlogr.close_on_error = TRUE) is set, then if an error occurs, all log files will be automatically closed. This behavior is not currently enabled by default.

Logs are stored on a stack, and so when one is closed, logging output returns to the previous log (if any).

Value

Number of flagged messages (numeric).

Note

If the log was being written to a connection, closelog will return the connection to its pre-logging state, whether open or closed.

See Also

openlog printlog

Examples

logfile1 <- openlog("A.log")
printlog("message to A", flag = TRUE)
logfile2 <- openlog("B.log")
printlog("message to B")
flagcountB <- closelog()
flagcountA <- closelog(sessionInfo = FALSE)
file.remove(logfile1, logfile2)

bpbond/luzlogr documentation built on March 2, 2024, 11:14 p.m.