Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/log-syslog-formatter'
Browse files Browse the repository at this point in the history
  • Loading branch information
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Writer/Syslog.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
namespace Zend\Log\Writer;

use Zend\Log\Exception;
use Zend\Log\Formatter;
use Zend\Log\Logger;
use Zend\Log\Formatter\Simple as SimpleFormatter;

/**
* Writes log messages to syslog
Expand Down Expand Up @@ -102,6 +102,8 @@ public function __construct(array $params = array())
if ($runInitializeSyslog) {
$this->initializeSyslog();
}

$this->setFormatter(new SimpleFormatter('%message%'));
}

/**
Expand Down Expand Up @@ -235,11 +237,7 @@ protected function doWrite(array $event)
$this->initializeSyslog();
}

if ($this->formatter instanceof Formatter) {
$message = $this->formatter->format($event);
} else {
$message = $event['message'];
}
$message = $this->formatter->format($event);

syslog($priority, $message);
}
Expand Down

0 comments on commit 6fe4efc

Please sign in to comment.