-
Notifications
You must be signed in to change notification settings - Fork 8
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
Ignore selected warnings (and other conditions?) #11
Comments
Currently there is no reliable way in R to recognize specific conditions: https://stackoverflow.com/q/52935066/4468078 Next step: Ask for advice at the r-devel mailing list (current status...) |
Related to #22 (where selected conditions must be recognized, repackaged and thrown as custom conditions - this also requires a reliable way in R to recognize specific conditions) |
Related to #71: The config could be extended with another column of a keywords-whitelist (or even regexp list) per condition class row to specify which conditions shall not be logged. Currently the config does only allow to unconditionally (!) enable and disable logging for a condition class vis "write.to.log"! The language translation of condition messages should not be required since the executor of a script knows quite good the configured language of the execution environment. So the configuration must just be adjusted accordingly. |
Great news: Adding a keyword list for conditions to be ignored could work now independently of language settings by "resetting" the language of the current R session to the language of the keywords (must be done by the user or somehow configured):
|
Add the possibility to disable the logging and printing of selected warnings.
Use cases:
Implementation hints:
Use a global option with a vector of strings (or regular expressions?).
This option is the default value for a new argument in
tryCatchLog()
.If the warning message contains any of these strings the warning will be dismissed.
Alternative implementation: Add a function
suppress.selected.warning()
and use it internally. Disadvantage: Difficult to overwrite in
tryCatchLog()
calls.Links:
gettext()
can be used to translate texts, but how? The MsgID is not known anymore once you get a translated message text sinceprintf
arguments are injected normally... (e. g. MsgID "In log(%s): NaNs produced" -> warning message forlog(-1)
is "In log(-1): NaNs produced"Localisation of messages in R is documented here:
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Locales
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Localization-of-messages
To find all possible translations of an error message you can use this solution:
https://stackoverflow.com/questions/49094581/identify-actual-message-language-settings-in-r
Other posts regarding message localization:
https://stackoverflow.com/questions/12642651/in-r-how-to-get-error-messages-in-english
https://stackoverflow.com/questions/49094581/identify-actual-message-language-settings-in-r
https://stackoverflow.com/questions/19111956/suppress-error-message-in-r
See also how the
gettext
toolchain is working to translate text strings contained in source code:The text was updated successfully, but these errors were encountered: