本文整理汇总了PHP中Zend\Log\Logger::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::__construct方法的具体用法?PHP Logger::__construct怎么用?PHP Logger::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Log\Logger
的用法示例。
在下文中一共展示了Logger::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
parent::__construct($options);
if ($options instanceof \Traversable) {
$options = ArrayUtils::iteratorToArray($options);
}
if (is_array($options)) {
if (!empty($options['stream'])) {
if (!is_array($options['stream'])) {
$options['stream'] = ['uri' => $options['stream']];
}
if (!empty($options['stream']['uri'])) {
$writer = new Stream($options['stream']['uri']);
if (!empty($options['stream']['priority'])) {
$filter = new Priority($options['stream']['priority']);
$writer->addFilter($filter);
}
$this->addWriter($writer);
}
}
if (!empty($options['slack'])) {
$writer = new SlackWriter($options['slack']);
$this->addWriter($writer);
}
if (!empty($options['register_error_handler'])) {
Logger::registerErrorHandler($this);
}
if (!empty($options['register_exception_handler'])) {
Logger::registerExceptionHandler($this);
}
}
}
示例2: __construct
public function __construct(array $options = [])
{
if (isset($options['name'])) {
$this->name = $options['name'];
unset($optiona['name']);
}
parent::__construct();
}
示例3: __construct
/**
* Construtor.
*
* Sets the logDir, logFile and thr writer. If the logDir is null, the system's temp dir will be used
*
* @param string $logFile
* @param string $logDir
*/
public function __construct($logFile, $logDir = null)
{
parent::__construct();
if (null === $logDir) {
$logDir = sys_get_temp_dir();
}
$this->setLogDir($logDir);
$this->setLogFile($logFile);
$writer = new Stream($logDir . DIRECTORY_SEPARATOR . $logFile);
$this->addWriter($writer);
}
示例4: __construct
public function __construct($options = null, $authService)
{
$defaultExtra = array('sessionId' => session_id(), 'host' => !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'CLI', 'path' => !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '', 'ip' => !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unavailable');
if ($authService && $authService->hasIdentity()) {
$identity = $authService->getIdentity();
$userID = null;
if (method_exists($identity, 'getId')) {
$userID = $identity->getID();
} elseif (property_exists($identity, 'getId')) {
$userID = $identity['getId'];
}
if ($userID) {
$defaultExtra['user'] = $userID;
}
}
$this->setDefaultExtra($defaultExtra);
parent::__construct($options);
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->formatter = new Logstash();
}
示例6: __construct
/**
* Accepted option keys:
* writers: array of writers to add to this record service (keys: name [, priority][, options])
* processors: array of processors to add to this record service (keys: name [, priority][, options])
* exceptionhandler: if true register this record service as exceptionhandler
* errorhandler: if true register this record service as errorhandler
* fatal_error_shutdownfunction: if true register this record service as fatal error shutdown
* @param array|Traversable|null $options
* @throws Exception\InvalidArgumentException
*/
public function __construct($options = null)
{
parent::__construct($options);
$this->priorities = array_replace($this->priorities, $this->gz3Priorities);
}
示例7: __construct
public function __construct(Translator $translator, $options = null)
{
$this->translator = $translator;
parent::__construct($options);
}