[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/log/ -> PhabricatorAccessLog.php (source)

   1  <?php
   2  
   3  final class PhabricatorAccessLog {
   4  
   5    static $log;
   6  
   7    public static function init() {
   8      // NOTE: This currently has no effect, but some day we may reuse PHP
   9      // interpreters to run multiple requests. If we do, it has the effect of
  10      // throwing away the old log.
  11      self::$log = null;
  12    }
  13  
  14    public static function getLog() {
  15      if (!self::$log) {
  16        $path = PhabricatorEnv::getEnvConfig('log.access.path');
  17        $format = PhabricatorEnv::getEnvConfig('log.access.format');
  18        $format = nonempty(
  19          $format,
  20          "[%D]\t%p\t%h\t%r\t%u\t%C\t%m\t%U\t%R\t%c\t%T");
  21  
  22        // NOTE: Path may be null. We still create the log, it just won't write
  23        // anywhere.
  24  
  25        $log = id(new PhutilDeferredLog($path, $format))
  26          ->setFailQuietly(true)
  27          ->setData(
  28            array(
  29              'D' => date('r'),
  30              'h' => php_uname('n'),
  31              'p' => getmypid(),
  32              'e' => time(),
  33            ));
  34  
  35        self::$log = $log;
  36      }
  37  
  38      return self::$log;
  39    }
  40  
  41  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1