]> git.mxchange.org Git - friendica.git/blob - tests/src/Util/Logger/SyslogLoggerWrapper.php
Merge pull request #7726 from tobiasd/20191010-uexport
[friendica.git] / tests / src / Util / Logger / SyslogLoggerWrapper.php
1 <?php
2
3 namespace Friendica\Test\src\Util\Logger;
4
5 use Friendica\Util\Introspection;
6 use Friendica\Util\Logger\SyslogLogger;
7 use Psr\Log\LogLevel;
8
9 /**
10  * Wraps the SyslogLogger for replacing the syslog call with a string field.
11  */
12 class SyslogLoggerWrapper extends SyslogLogger
13 {
14         private $content;
15
16         public function __construct($channel, Introspection $introspection, $level = LogLevel::NOTICE, $logOpts = LOG_PID, $logFacility = LOG_USER)
17         {
18                 parent::__construct($channel, $introspection, $level, $logOpts, $logFacility);
19
20                 $this->content = '';
21         }
22
23         /**
24          * Gets the content from the wrapped Syslog
25          *
26          * @return string
27          */
28         public function getContent()
29         {
30                 return $this->content;
31         }
32
33         /**
34          * {@inheritdoc}
35          */
36         protected function syslogWrapper($level, $entry)
37         {
38                 $this->content .= $entry . PHP_EOL;
39         }
40 }