mirror of https://github.com/zulip/zulip.git
error logging: Simplify deployment data.
We no longer have intermediate constants of `git_described` and `zulip_version_const`. Instead, we make a `deployment_data` dictionary that is grep-friendly, and we just let `deployment_repr` do simple formatting without translating string constants. This is pretty easy to test: - set DEBUG_ERROR_REPORTING = True - modify some code to throw an exception - see error output in #errors - use "/emails" with text-only option to view errors
This commit is contained in:
parent
710e3144e7
commit
ebb16e7a68
|
@ -33,11 +33,8 @@ def user_info_str(report: Dict[str, Any]) -> str:
|
|||
|
||||
def deployment_repr(report: Dict[str, Any]) -> str:
|
||||
deployment = 'Deployed code:\n'
|
||||
for (label, field) in [('git', 'git_described'),
|
||||
('ZULIP_VERSION', 'zulip_version_const'),
|
||||
]:
|
||||
if report[field] is not None:
|
||||
deployment += '- %s: %s\n' % (label, report[field])
|
||||
for field, val in report['deployment_data'].items():
|
||||
deployment += '- %s: %s\n' % (field, val)
|
||||
return deployment
|
||||
|
||||
def notify_browser_error(report: Dict[str, Any]) -> None:
|
||||
|
|
|
@ -26,8 +26,10 @@ def try_git_describe() -> Optional[str]:
|
|||
return None
|
||||
|
||||
def add_deployment_metadata(report: Dict[str, Any]) -> None:
|
||||
report['git_described'] = try_git_describe()
|
||||
report['zulip_version_const'] = ZULIP_VERSION
|
||||
report['deployment_data'] = dict(
|
||||
git=try_git_describe(),
|
||||
ZULIP_VERSION=ZULIP_VERSION,
|
||||
)
|
||||
|
||||
def add_request_metadata(report: Dict[str, Any], request: HttpRequest) -> None:
|
||||
report['has_request'] = True
|
||||
|
|
Loading…
Reference in New Issue