From 98caa8eaf1829e35ee1da5f2183f6954f916d32a Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Wed, 13 Nov 2013 15:35:04 -0500 Subject: [PATCH] Add option to disable error reporting (imported from commit 3621aa6e7a5badd21b22891026285099db393df0) --- zerver/views/__init__.py | 3 +++ zproject/local_settings_template.py | 4 ++++ zproject/settings.py | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index 01b942a033..3b977725cc 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -1931,6 +1931,9 @@ def json_report_error(request, user_profile, message=REQ, stacktrace=REQ, href=REQ, log=REQ, more_info=REQ(converter=json_to_dict, default=None)): + if not settings.ERROR_REPORTING: + return json_success() + if js_source_map: stacktrace = js_source_map.annotate_stacktrace(stacktrace) diff --git a/zproject/local_settings_template.py b/zproject/local_settings_template.py index e09ba98435..ad21a4330d 100644 --- a/zproject/local_settings_template.py +++ b/zproject/local_settings_template.py @@ -45,6 +45,10 @@ EMAIL_USE_TLS = True # which can be used to send feedback directly to Zulip ENABLE_FEEDBACK = True +# Control whether or not error reports are sent to Zulip. Error reports +# do not include message content. +ERROR_REPORTING = True + # By default uploaded files and avatars are stored directly on the Zulip server # If file storage to Amazon S3 is desired, please contact Zulip Support # (support@zulip.com) for further instructions on setting up S3 integration diff --git a/zproject/settings.py b/zproject/settings.py index c004b1f98b..179b0cb2e9 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -245,6 +245,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'MAILCHIMP_API_KEY': '', 'LOCAL_UPLOADS_DIR': None, 'DROPBOX_APP_KEY': '', + 'ERROR_REPORTING': True, # The following bots only exist in non-ENTERPRISE installs 'ERROR_BOT': None, 'NEW_USER_BOT': None, @@ -653,7 +654,8 @@ LOGGING = { 'propagate': False, }, 'django': { - 'handlers': ['zulip_admins', 'console', 'file'], + 'handlers': (['zulip_admins'] if ERROR_REPORTING else []) + + ['console', 'file'], 'level': 'INFO', 'propagate': False, },