Path: blob/master/src/infrastructure/log/PhabricatorAccessLog.php
12241 views
<?php12final class PhabricatorAccessLog extends Phobject {34private static $log;56public static function init() {7// NOTE: This currently has no effect, but some day we may reuse PHP8// interpreters to run multiple requests. If we do, it has the effect of9// throwing away the old log.10self::$log = null;11}1213public static function getLog() {14if (!self::$log) {15$path = PhabricatorEnv::getEnvConfig('log.access.path');16$format = PhabricatorEnv::getEnvConfig('log.access.format');17$format = nonempty(18$format,19"[%D]\t%p\t%h\t%r\t%u\t%C\t%m\t%U\t%R\t%c\t%T");2021// NOTE: Path may be null. We still create the log, it just won't write22// anywhere.2324$log = id(new PhutilDeferredLog($path, $format))25->setFailQuietly(true)26->setData(27array(28'D' => date('r'),29'h' => php_uname('n'),30'p' => getmypid(),31'e' => time(),32'I' => PhabricatorEnv::getEnvConfig('cluster.instance'),33));3435self::$log = $log;36}3738return self::$log;39}4041}424344