Skip to contents

This utility function evaluates eyeris commands while automatically capturing and recording both standard output (stdout) and standard error (stderr) to timestamped log files in your desired log directory.

Usage

eyelogger(
  eyeris_cmd,
  log_dir = file.path(tempdir(), "eyeris_logs"),
  timestamp_format = "%Y%m%d_%H%M%S"
)

Arguments

eyeris_cmd

An eyeris command, wrapped in {} if multiline

log_dir

Character path to the desired log directory. Is set to the temporary directory given by tempdir() by default

timestamp_format

Format string passed to format(Sys.time()) for naming the log files. Defaults to "%Y%m%d_%H%M%S"

Value

The result of the evaluated eyeris command (invisibly)

Details

Each run produces two log files:

  • <timestamp>.out: records all console output

  • <timestamp>.err: records all warnings and errors

Examples

eyelogger({
  message("eyeris `glassbox()` completed successfully.")
  warning("eyeris `glassbox()` completed with warnings.")
  print("some eyeris-related information.")
})
#> eyeris `glassbox()` completed successfully.
#> Warning: eyeris `glassbox()` completed with warnings.

eyelogger({
  glassbox(eyelink_asc_demo_dataset(), interactive_preview = FALSE)
}, log_dir = file.path(tempdir(), "eyeris_logs"))
#>  [  OK  ] - Running eyeris::load_asc()
#>  [ INFO ] - Processing block: block_1
#>  [  OK  ] - Running eyeris::deblink() for block_1
#>  [  OK  ] - Running eyeris::detransient() for block_1
#>  [  OK  ] - Running eyeris::interpolate() for block_1
#>  [  OK  ] - Running eyeris::lpfilt() for block_1

#> ! [ SKIP ] - Skipping eyeris::downsample() for block_1
#> ! [ SKIP ] - Skipping eyeris::bin() for block_1
#> ! [ SKIP ] - Skipping eyeris::detrend() for block_1
#>  [  OK  ] - Running eyeris::zscore() for block_1
#>  [  OK  ] - Running eyeris::summarize_confounds()