-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add --silent option to ctsm_logging python infrastructure #1941
Comments
This is simple to do: index ff51c6d8f..9768fed5f 100644
--- a/python/ctsm/ctsm_logging.py
+++ b/python/ctsm/ctsm_logging.py
@@ -68,6 +68,9 @@ def add_logging_args(parser):
logging_level.add_argument(
"-v", "--verbose", action="store_true", help="Output extra logging info"
)
+ logging_level.add_argument(
+ "-s", "--silent", action="store_true", help="Only output errors"
+ )
logging_level.add_argument(
"--debug",
@@ -84,6 +87,8 @@ def process_logging_args(args):
root_logger.setLevel(logging.DEBUG)
elif args.verbose:
root_logger.setLevel(logging.INFO)
+ elif args.silent:
+ root_logger.setLevel(logging.ERROR)
else:
root_logger.setLevel(logging.WARNING)
|
Additional error checking could be done to ensure that you don't try to turn more than one of verbose, silent, or debug at once. |
And the doc/design/python_script_user_interface.rst should be updated. |
Sounds good. There should already be error-checking in place to ensure that only one logging option is chosen, via the use of a mutually-exclusive group: CTSM/python/ctsm/ctsm_logging.py Line 66 in c155ccb
One thing I'd change from your proposed solution is that I don't think we should allow the short |
I'd like to add a "--silent" option to ctsm_logging for our python scripts. This would allow an additional logging level that would suppress warnings, but still abort on error.
The reason this would be helpful is that subset_data writes out a warning if the --dom-pft option is used and for #1812 I'd like the warning to not show up.
The text was updated successfully, but these errors were encountered: