mirror of https://github.com/zulip/zulip.git
blueslip: Send the log back to the server when reporting errors
(imported from commit 013057a8ddc2ddb73b03b0de5c139052b22f5319)
This commit is contained in:
parent
3276f8a4d0
commit
c665139012
|
@ -52,6 +52,12 @@ Logger.prototype = (function () {
|
|||
var log_entry = date_str + " " + name.toUpperCase() +
|
||||
': ' + str_args.join("");
|
||||
this._memory_log.push(log_entry);
|
||||
|
||||
// Don't let the log grow without bound
|
||||
if (this._memory_log.length > 1000) {
|
||||
this._memory_log.shift();
|
||||
}
|
||||
|
||||
return console[name].apply(console, arguments);
|
||||
};
|
||||
}
|
||||
|
@ -110,7 +116,8 @@ function report_error(msg, stack, opts) {
|
|||
ui_message: opts.show_ui_msg,
|
||||
more_info: JSON.stringify(opts.more_info),
|
||||
href: window.location.href,
|
||||
user_agent: window.navigator.userAgent},
|
||||
user_agent: window.navigator.userAgent,
|
||||
log: logger.get_log().join("\n")},
|
||||
timeout: 3*1000,
|
||||
success: function () {
|
||||
reported_errors[key] = true;
|
||||
|
|
|
@ -2452,7 +2452,7 @@ if not (settings.DEBUG or settings.TEST_SUITE):
|
|||
@has_request_variables
|
||||
def json_report_error(request, user_profile, message=REQ, stacktrace=REQ,
|
||||
ui_message=REQ(converter=json_to_bool), user_agent=REQ,
|
||||
href=REQ,
|
||||
href=REQ, log=REQ,
|
||||
more_info=REQ(converter=json_to_dict, default=None)):
|
||||
subject = "error for %s" % (user_profile.email,)
|
||||
if ui_message:
|
||||
|
@ -2479,6 +2479,8 @@ def json_report_error(request, user_profile, message=REQ, stacktrace=REQ,
|
|||
for (key, value) in more_info.iteritems():
|
||||
body += "\n %s: %s" % (key, value)
|
||||
|
||||
body += "\n\nLog:\n%s" % (log,)
|
||||
|
||||
mail_admins(subject, body)
|
||||
return json_success()
|
||||
|
||||
|
|
Loading…
Reference in New Issue