Adding Logger Tests

This commit is contained in:
Philipp Holzer 2019-03-04 23:49:37 +01:00 committed by Hypolite Petovan
parent aee348fa02
commit f63956851b
3 changed files with 38 additions and 3 deletions

View file

@ -59,4 +59,15 @@ class SyslogLoggerTest extends AbstractLoggerTest
$logger->log('NOPE', 'a test');
}
/**
* Test when the logfacility is wrong (string)
* @expectedException \UnexpectedValueException
* @expectedExceptionMessageRegExp /Can\'t open syslog for ident ".*" and facility ".*": .* /
*/
public function testServerException()
{
$logger = new SyslogLoggerWrapper('test', $this->introspection, LogLevel::DEBUG, null, 'a string');
$logger->emergency('not working');
}
}

View file

@ -6,6 +6,9 @@ use Friendica\Util\Introspection;
use Friendica\Util\Logger\SyslogLogger;
use Psr\Log\LogLevel;
/**
* Wraps the SyslogLogger for replacing the syslog call with a string field.
*/
class SyslogLoggerWrapper extends SyslogLogger
{
private $content;