Skip to content

Feature request: log traceback in addition to error when stop is called #86

@DavideMessinaARS

Description

@DavideMessinaARS

I have an algorithm which is divided in various steps, all of them called inside a to_run file.

I want to log not only the errors but the traceback too.

I have written a function that does that:

log_traceback <- function(file_log) {
  file_log <- readLines(file_logfile_log)
  if (substr(tail(file_log, 1), start = 1, stop = 5) == "ERROR"){
    invisible(lapply(.traceback(), log_error))
  }
}

However the function works only when I call it and not when the errors occur.

This means that after each step I would need to call the function which is not ideal for various reasons. (Otherwise the traceback will be overwritten by the next error)

Would it be possible to add an option for logging the traceback inside the log_errors() function? (Or create a log_traceback function)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions