You are here

function _mongodb_watchdog_enhance_log_entry in MongoDB 8

Same name and namespace in other branches
  1. 6 mongodb_watchdog/mongodb_watchdog.module \_mongodb_watchdog_enhance_log_entry()
  2. 7 mongodb_watchdog/mongodb_watchdog.module \_mongodb_watchdog_enhance_log_entry()

Fill in the log_entry function, file, and line.

Parameters

array $log_entry:

array $backtrace:

Return value

void

1 call to _mongodb_watchdog_enhance_log_entry()
mongodb_watchdog_watchdog in mongodb_watchdog/mongodb_watchdog.module
Implements hook_watchdog().

File

mongodb_watchdog/mongodb_watchdog.module, line 116
Fires watchdog messages to mongodb.

Code

function _mongodb_watchdog_enhance_log_entry(&$log_entry, $backtrace) {

  // Create list of functions to ignore in backtrace.
  static $ignore = array(
    'mongodb_watchdog_watchdog' => 1,
    'call_user_func_array' => 1,
    'module_invoke' => 1,
    'watchdog' => 1,
    '_drupal_log_error' => 1,
    '_drupal_error_handler' => 1,
    '_drupal_error_handler_real' => 1,
    'theme_render_template' => 1,
  );
  foreach ($backtrace as $bt) {
    if (isset($bt['function'])) {
      if (isset($bt['line']) && !isset($ignore[$bt['function']])) {
        if (isset($bt['file'])) {
          $log_entry['file'] = $bt['file'];
        }
        $log_entry['function'] = $bt['function'];
        $log_entry['line'] = $bt['line'];
        break;
      }
      elseif ($bt['function'] == '_drupal_exception_handler') {
        $e = $bt['args'][0];
        _mongodb_watchdog_enhance_log_entry($log_entry, $e
          ->getTrace());
      }
    }
  }
}