The log_suspend function function suspends printing to the log, but does not close it. The function will not print the log footer. To reopen the log, call log_resume.

log_suspend()

Value

None

See also

log_resume to continue logging.

Examples

library(logr)

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

# Open log
lf <- log_open(tmp)

# Send message to log
log_print("Before suspend")
#> Before suspend 

# Suspend log
log_suspend()
#> Log suspended

# View suspended log
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:06.639343 
#> ========================================================================= 
#> 
#> Before suspend 
#> 
#> NOTE: Log Print Time:  2025-10-14 20:31:06.641201 
#> NOTE: Elapsed Time: 0.00140380859375 secs 
#> 
#> ========================================================================= 
#> Log suspended 
#> ========================================================================= 
#> 
#> Autolog: FALSE 
#> Log Path: /tmp/RtmpORwY5l/log/test.log 
#> Msg Path: /tmp/RtmpORwY5l/log/test.msg 
#> Show Notes: TRUE 
#> Blank After: TRUE 
#> Traceback: TRUE 
#> Status: open 
#> Tidylog: 
#> Log Time: 2025-10-14 20:31:06.641201 
#> Start Time: 2025-10-14 20:31:06.639798 
#> Suspend Time: 2025-10-14 20:31:06.653928 
#> Elapsed Time: 0.0127265453338623 
#> 

# Resume log
log_resume(lf)
#> [1] "/tmp/RtmpORwY5l/log/test.log"

# Print data to log
log_print("After suspend")
#> After suspend 

# 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:06.639343 
#> ========================================================================= 
#> 
#> Before suspend 
#> 
#> NOTE: Log Print Time:  2025-10-14 20:31:06.641201 
#> NOTE: Elapsed Time: 0.00140380859375 secs 
#> 
#> =========================================================================
#> Log Suspended: 2025-10-14 20:31:06.653928
#> Log Resumed: 2025-10-14 20:31:06.657104
#> Elapsed Time: 0 00:00:00
#> =========================================================================
#> 
#> After suspend 
#> 
#> NOTE: Log Print Time:  2025-10-14 20:31:06.658745 
#> NOTE: Elapsed Time: 0.00110888481140137 secs 
#> 
#> ========================================================================= 
#> Log End Time: 2025-10-14 20:31:06.666639 
#> Log Elapsed Time: 0 00:00:00 
#> =========================================================================