for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* Balloon
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2012-2017 gyselroth GmbH (https://gyselroth.com)
* @license GPL-3.0 https://opensource.org/licenses/GPL-3.0
*/
namespace Micro\Log\Adapter;
use Micro\Log\Log;
class Syslog extends AbstractAdapter
{
* Syslog ident.
* @var string
protected $ident;
* Option.
* @var int
protected $option = LOG_PID;
* Facility.
protected $facility = LOG_SYSLOG;
* Set options.
* @return AdapterInterface
public function setOptions(? Iterable $config = null): AdapterInterface
if (null === $config) {
return $this;
}
foreach ($config as $option => $value) {
switch ($option) {
case 'ident':
$this->ident = (string) $value;
unset($config[$option]);
break;
case 'option':
$this->option = (int) (string) $value;
case 'facility':
$this->facility = (int) (string) $value;
parent::setOptions($config);
openlog($this->ident, $this->option, $this->facility);
* Log.
* @param string $level
* @param string $message
* @return bool
public function log(string $level, string $message): bool
return syslog(Log::PRIORITIES[$level], $message);