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); } } }
public function __construct(array $options = []) { if (isset($options['name'])) { $this->name = $options['name']; unset($optiona['name']); } parent::__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); }
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); }
public function __construct() { parent::__construct(); $this->formatter = new Logstash(); }
/** * 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); }
public function __construct(Translator $translator, $options = null) { $this->translator = $translator; parent::__construct($options); }