1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 00:26:10 +02:00
This commit is contained in:
Jordi Boggiano
2015-07-14 10:25:17 +01:00
parent cf6fa57dd4
commit ca1376bd61
20 changed files with 42 additions and 41 deletions

View File

@@ -56,8 +56,7 @@ class RedisHandler extends AbstractProcessingHandler
*/
protected function write(array $record)
{
if ($this->capSize)
{
if ($this->capSize) {
$this->writeCapped($record);
} else {
$this->redisClient->rpush($this->redisKey, $record["formatted"]);
@@ -73,7 +72,7 @@ class RedisHandler extends AbstractProcessingHandler
*/
protected function writeCapped(array $record)
{
if($this->redisClient instanceof \Redis) {
if ($this->redisClient instanceof \Redis) {
$this->redisClient->multi()
->rpush($this->redisKey, $record["formatted"])
->ltrim($this->redisKey, -$this->capSize, -1)
@@ -81,7 +80,7 @@ class RedisHandler extends AbstractProcessingHandler
} else {
$redisKey = $this->redisKey;
$capSize = $this->capSize;
$this->redisClient->transaction(function($tx) use($record, $redisKey, $capSize) {
$this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) {
$tx->rpush($redisKey, $record["formatted"]);
$tx->ltrim($redisKey, -$capSize, -1);
});