You are here

function filelog_watchdog in File Log 6.2

Same name and namespace in other branches
  1. 6 filelog.module \filelog_watchdog()
  2. 7 filelog.module \filelog_watchdog()

Implementation of hook_watchdog().

File

./filelog.module, line 11
Writes logging messages into files.

Code

function filelog_watchdog($entry) {
  static $shutdown;
  if (!$shutdown) {
    register_shutdown_function('_filelog_shutdown');
    $shutdown = TRUE;
  }
  $f = _filelog_get_conf();
  if (!empty($f['type_levels']) && array_key_exists($entry['type'], $f['type_levels'])) {
    if ($entry['severity'] > $f['type_levels'][$entry['type']]) {
      return;
    }
  }
  else {
    if ($entry['severity'] > $f['log_level']) {
      return;
    }
  }
  if ($path = filelog_path($entry)) {
    $msg = ($f['with_ui'] ? _filelog_format_for_ui($entry) : theme('filelog_format', $entry)) . "\n";
    if ($f['buffer']) {
      _filelog_buffer($path, $msg);
    }
    else {
      if ($fp = _filelog_get_pointer($path)) {
        fwrite($fp, $msg);
      }
    }
  }
}