Logging and errors

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(eider)

Logging in eider

eider uses the logger package to log messages. Most messages in eider are logged at either the DEBUG level (when eider is e.g. parsing information from JSON), or at the TRACE level (most functions in eider log a TRACE message containing the execution context).

When running a pipeline, you can set the logging level with either:

logger::log_threshold(logger::DEBUG)

which causes the DEBUG messages to be displayed, or:

logger::log_threshold(logger::TRACE)

which causes both the TRACE and DEBUG messages to be displayed.

Errors with context

Additionally, the execution context (which is usually restricted to TRACE messages) is also displayed when eider runs into an error. If you run into an error that does not provide enough information, please consider submitting an issue.

Here are a few examples:

Wrong transformation type

writeLines(readLines("json_examples/logging1.json"))

In the JSON above (json_examples/logging1.json), an invalid transformation_type is specified. Notice how the resulting error tells you which JSON file the error occurs in.

run_pipeline(
  data_sources = list(ae2 = eider_example("random_ae_data.csv")),
  feature_filenames = "json_examples/logging1.json"
)

Wrong column name

writeLines(readLines("json_examples/logging2.json"))

Here (json_examples/logging2.json), a grouping_column is specified, but such a column does not exist in the input table.

run_pipeline(
  data_sources = list(ae2 = eider_example("random_ae_data.csv")),
  feature_filenames = "json_examples/logging2.json"
)

Data type mismatch

writeLines(readLines("json_examples/logging3.json"))

This example (json_examples/logging3.json) specifies that the table should be filtered to only retain rows where diagnosis_1 is equal to "a string", but in the actual table, diagnosis_1 is an integer.

run_pipeline(
  data_sources = list(ae2 = eider_example("random_ae_data.csv")),
  feature_filenames = "json_examples/logging3.json"
)


Try the eider package in your browser

Any scripts or data that you put into this service are public.

eider documentation built on May 29, 2024, 7:27 a.m.