ghqc::ghqc_log()
ghqc::ghqc_log() streams log output from the ghqc background process started by ghqc::ghqc().
It is meant for live debugging when you want to watch server output directly in the R console.
ghqc::ghqc_log()What It Does
Section titled “What It Does”When you call ghqc::ghqc_log():
- the function checks whether the current R session is tracking a running ghqc process
- it polls the process error stream continuously
- it filters log lines according to the requested log level
- it prints matching output as it arrives
The call blocks the R session until you interrupt it or the ghqc process exits.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
log_level | Minimum log level to display. Defaults to Sys.getenv(“GHQC_LOG_LEVEL”, “DEBUG”). Valid values are TRACE, DEBUG, INFO, WARN, and ERROR. |
interval | Polling interval in seconds. Defaults to 0.2. |
Log Filtering
Section titled “Log Filtering”ghqc::ghqc_log() filters log output in R after the process starts.
That means:
- lower-severity messages can be hidden from the console
- invalid
log_levelvalues fail immediately - the server must already be running before you can stream logs from it
Example
Section titled “Example”ghqc::ghqc()ghqc::ghqc_log(log_level = "INFO")To stop streaming, interrupt the R session with Ctrl+C or Escape in RStudio / Positron.
Behavior When No Server Is Running
Section titled “Behavior When No Server Is Running”- if no ghqc process has been started in the current R session, the function prints a message and returns
NULLinvisibly - if the tracked process exists but is no longer alive, it reports that the server is not running and returns
NULLinvisibly - if the process exits while logs are being streamed, the function prints any remaining filtered output, reports that the server has stopped, and exits