-
Notifications
You must be signed in to change notification settings - Fork 34
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
How to use futile.logger to override the default warnings #75
Comments
Sorry, I don't know. Looks like there's a number of things to investigate for improvements though! |
I have also been battling this one. It seems errors vs warnings are handled differently, and even the options(error = function() ) I have found people suggesting is old and should be deprecated... The best I have been able to find is to do:
|
You could use my tryCatchLog package (I am the author) and "silence" the warning when calling your code as well as automatically log the warnings (and errors and messages) via:
If you want to silence warnings globally (as your example to set the option implies) it requires a small R stub code to call your "main" entry point in your script:
You could also do this via
PS: |
I have no idea what I ended up using when I opened this issue (and I've not been programming in R for a couple of years now), but I remember I used |
Thanks a lot :-) I will leave this issue open until I have time to add the proposed solutions to a new FAQ section here... |
I can override the default R error handling for a non-interactive program by doing
options(error = function() { flog.error(geterrmessage()) ; quit(runLast=FALSE)})
However I did not find how to do the same for warnings. Is this possible?
This stack overflow question basically poses the same question, but the accepted answer does not seem to work for me.
The text was updated successfully, but these errors were encountered: