/** * @param string|Settings $settings */ public function __construct($settings = null) { parent::__construct($settings); if ($this->settings->logQueries) { $this->log(Log::getInstance($this->settings->logQueries)); } }
public function __construct($settings = null) { parent::__construct($settings); $this->reset(); if ($this->settings) { if ($this->settings->proxy) { $this->setProxy($this->settings->proxy); } if ($this->settings->defaultHeaders) { $this->defaultHeaders = array_merge($this->defaultHeaders, $this->settings->defaultHeaders); } if ($this->settings->log) { $log = Log::getInstance($this->settings->log); $this->logUrl($log); $this->logContext($log); $this->logResponseHeaders($log); $this->logResponseBody($log); $this->logError($log); } } $this->mock = Mock::getNull(); }
<?php namespace PHPerf; use Yaoi\Database; use Yaoi\Http\Auth; use Yaoi\Http\Auth\Settings; use Yaoi\Log; use Yaoi\Storage; date_default_timezone_set('Europe/Moscow'); header("Content-Type: text/html; charset=utf8"); error_reporting(E_ALL); ini_set('display_errors', 'on'); umask('0002'); Auth::register(function () { $dsn = new Settings(); $dsn->title = 'Developers Only Area'; $dsn->salt = '<random-string>'; $dsn->users = array('<login>' => '<password-hash>'); return $dsn; }, 'dev'); Storage::register(new Storage\PhpVar(), 'debug_log'); Log::register('storage:///?storage=debug_log', 'debug_log'); Database::register(function () { $database = new Database('mysqli://root@localhost/phperf_result'); $database->log(Log::getInstance('debug_log')); return $database; });
/** * @param string $identifier * @return Log */ static function log($identifier = Service::PRIMARY) { return Log::getInstance($identifier); }