Skip to content
ghqc

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()

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.

ArgumentDescription
log_levelMinimum log level to display. Defaults to Sys.getenv(“GHQC_LOG_LEVEL”, “DEBUG”). Valid values are TRACE, DEBUG, INFO, WARN, and ERROR.
intervalPolling interval in seconds. Defaults to 0.2.

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_level values fail immediately
  • the server must already be running before you can stream logs from it
ghqc::ghqc()
ghqc::ghqc_log(log_level = "INFO")

To stop streaming, interrupt the R session with Ctrl+C or Escape in RStudio / Positron.

  • if no ghqc process has been started in the current R session, the function prints a message and returns NULL invisibly
  • if the tracked process exists but is no longer alive, it reports that the server is not running and returns NULL invisibly
  • if the process exits while logs are being streamed, the function prints any remaining filtered output, reports that the server has stopped, and exits