mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
Merge branch '1.x'
This commit is contained in:
27
.travis.yml
27
.travis.yml
@@ -1,25 +1,26 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
php:
|
|
||||||
- 7.2
|
|
||||||
- 7.3
|
|
||||||
- 7.4
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.composer/cache
|
- $HOME/.composer/cache
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
fast_finish: true
|
||||||
- php: 7.2
|
include:
|
||||||
env: deps=low
|
- php: 7.2
|
||||||
fast_finish: true
|
dist: bionic
|
||||||
allow_failures:
|
- php: 7.3
|
||||||
- php: nightly
|
dist: bionic
|
||||||
|
- php: 7.4
|
||||||
|
dist: bionic
|
||||||
|
- php: nightly
|
||||||
|
dist: bionic
|
||||||
|
- php: 7.2
|
||||||
|
env: deps=low
|
||||||
|
allow_failures:
|
||||||
|
- php: nightly
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
@@ -157,6 +157,10 @@ class JsonFormatter extends NormalizerFormatter
|
|||||||
return $this->normalizeException($data, $depth);
|
return $this->normalizeException($data, $depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_resource($data)) {
|
||||||
|
return parent::normalize($data);
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,8 @@ class RedisHandler extends AbstractProcessingHandler
|
|||||||
protected function writeCapped(array $record): void
|
protected function writeCapped(array $record): void
|
||||||
{
|
{
|
||||||
if ($this->redisClient instanceof \Redis) {
|
if ($this->redisClient instanceof \Redis) {
|
||||||
$this->redisClient->multi()
|
$mode = defined('\Redis::MULTI') ? \Redis::MULTI : 1;
|
||||||
|
$this->redisClient->multi($mode)
|
||||||
->rpush($this->redisKey, $record["formatted"])
|
->rpush($this->redisKey, $record["formatted"])
|
||||||
->ltrim($this->redisKey, -$this->capSize, -1)
|
->ltrim($this->redisKey, -$this->capSize, -1)
|
||||||
->exec();
|
->exec();
|
||||||
|
@@ -185,6 +185,14 @@ class JsonFormatterTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDefFormatWithResource()
|
||||||
|
{
|
||||||
|
$formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false);
|
||||||
|
$record = $this->getRecord();
|
||||||
|
$record['context'] = ['field_resource' => curl_init()];
|
||||||
|
$this->assertEquals('{"message":"test","context":{"field_resource":"[resource(curl)]"},"level":300,"level_name":"WARNING","channel":"test","datetime":"'.$record['datetime']->format('Y-m-d\TH:i:s.uP').'","extra":{}}', $formatter->format($record));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @param string $actual
|
* @param string $actual
|
||||||
|
Reference in New Issue
Block a user