#1419652: [Meta] javascript logging and error reporting

This patch adds a Drupal.log(message, type) function that wraps around the console object and falls back to alert for retarded browsers.
Types available are the same as in drupal_set_message(), each is mapped to the relevant console method: status is console.log(), warning is console.warn() and error is console.error(), unknown types just add a 'mycustomtype: ' prefix to the message.

I'm using values from error_level to choose which error to display with a catch

  • ERROR_REPORTING_HIDE displays nothing,
  • ERROR_REPORTING_DISPLAY_SOME (which is called Errors and warnings in the admin form) only displays warnings.
  • ERROR_REPORTING_DISPLAY_ALL All of the above plus errors.

There will be changes to make to this patch but i'm not sure at which level, I need some help integrating this properly. I'm not talking about a watchdog interface there are other issues for it.

Files: 
CommentFileSizeAuthor
core-js-error-reporting-piggy-back.patch2.51 KBnod_
FAILED: [[SimpleTest]]: [MySQL] 34,270 pass(es), 2 fail(s), and 4 exception(s).
[ View ]

Comments

Status:Needs review» Needs work
Issue tags:-JavaScript

The last submitted patch, core-js-error-reporting-piggy-back.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work
Issue tags:+JavaScript

The last submitted patch, core-js-error-reporting-piggy-back.patch, failed testing.

See #1232416-58: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors. I recommend merging this work into there and then closing this as a duplicate. It's always nice to have a use-case in the same patch as a new function, and that issue has as good a one as any, in my opinion.

@nod_: I think the constant ERROR_REPORTING_DISPLAY_ALL is not in scope in drupal_add_js().
Try to load it into scope with the following line in front of the array definition in drupal_add_js().

require_once DRUPAL_ROOT . '/includes/errors.inc';

Issue summary:View changes

link to meta