certbot: Stop using print in log module. (#5160)

* Update certbot.log.post_arg_parse_except_hook function.
* Update certbot.tests.log_test._test_common method.

See discussion #3720.
This commit is contained in:
r5d
2017-10-03 12:52:41 -07:00
committed by Brad Warren
parent b0e5809df2
commit b9d129bd43
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -359,11 +359,11 @@ def post_arg_parse_except_hook(exc_type, exc_value, trace, debug, log_path):
logger.debug('Exiting abnormally:', exc_info=exc_info)
if issubclass(exc_type, errors.Error):
sys.exit(exc_value)
print('An unexpected error occurred:', file=sys.stderr)
logger.error('An unexpected error occurred:')
if messages.is_acme_error(exc_value):
# Remove the ACME error prefix from the exception
_, _, exc_str = str(exc_value).partition(':: ')
print(exc_str, file=sys.stderr)
logger.error(exc_str)
else:
traceback.print_exception(exc_type, exc_value, None)
exit_with_log_path(log_path)