Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DavideMessinaARS opened this issue May 19, 2021 · 2 comments · Fixed by #223
Closed

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

DavideMessinaARS opened this issue May 19, 2021 · 2 comments · Fixed by #223
Labels
help wanted Extra attention is needed

Comments

@DavideMessinaARS
Copy link

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)

@1beb
Copy link

1beb commented Oct 16, 2021

tryCatchLog does this. https://github.com/aryoda/tryCatchLog

@daroczig
Copy link
Owner

Thanks for the feature request! As I am busy with other things, I don't think I have the time to work in this in the coming months, so I would highly appreciate if someone can come up with a PR -- so thus I'm now setting the related "Help wanted" label.

@daroczig daroczig added the help wanted Extra attention is needed label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants