You are here

function filelog_watchdog in File Log 6

Same name and namespace in other branches
  1. 6.2 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) {
  $f = _filelog_get_conf();
  if ($entry['severity'] <= $f['log_level']) {
    if ($dir = filelog_directory()) {
      $file = filelog_filename($entry);
      $retry = 0;
      while ($retry < 3) {
        if ($fp = @fopen($dir . '/' . $file, 'ab')) {
          fwrite($fp, theme('filelog_format', $entry) . "\n");
          fclose($fp);
          $retry = 3;
          break;
        }
        $retry++;
        usleep(250);
      }
    }
  }
}