You are here

function _filelog_get_pointer in File Log 6.2

2 calls to _filelog_get_pointer()
filelog_watchdog in ./filelog.module
Implementation of hook_watchdog().
_filelog_shutdown in ./filelog.module

File

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

Code

function _filelog_get_pointer($path, $cache = TRUE) {
  static $pointers = array();
  if (is_null($path)) {
    return $pointers;
  }
  if ($cache && isset($pointers[$path])) {
    return $pointers[$path];
  }
  $retry = 0;
  while ($retry < 3) {
    if ($fp = fopen($path, 'ab')) {
      stream_set_blocking($fp, 0);
      break;
    }
    $retry++;
    usleep(250);
  }
  if ($fp && $cache) {
    $pointers[$path] = $fp;
  }
  return $fp;
}