1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 18:00:17 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2019-07-02 15:55:14 +02:00
5 changed files with 19 additions and 2 deletions

View File

@@ -81,8 +81,9 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset
$processed = [];
foreach ($records as $record) {
foreach ($this->processors as $processor) {
$processed[] = call_user_func($processor, $record);
$record = call_user_func($processor, $record);
}
$processed[] = $record;
}
$records = $processed;
}

View File

@@ -65,6 +65,7 @@ class StreamHandler extends AbstractProcessingHandler
fclose($this->stream);
}
$this->stream = null;
$this->dirCreated = null;
}
/**

View File

@@ -50,8 +50,9 @@ class WhatFailureGroupHandler extends GroupHandler
$processed = array();
foreach ($records as $record) {
foreach ($this->processors as $processor) {
$processed[] = call_user_func($processor, $record);
$record = call_user_func($processor, $record);
}
$processed[] = $record;
}
$records = $processed;
}

View File

@@ -99,6 +99,11 @@ class GroupHandlerTest extends TestCase
return $record;
});
$handler->pushProcessor(function ($record) {
$record['extra']['foo2'] = true;
return $record;
});
$handler->handleBatch([$this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)]);
foreach ($testHandlers as $test) {
$this->assertTrue($test->hasDebugRecords());
@@ -107,6 +112,8 @@ class GroupHandlerTest extends TestCase
$records = $test->getRecords();
$this->assertTrue($records[0]['extra']['foo']);
$this->assertTrue($records[1]['extra']['foo']);
$this->assertTrue($records[0]['extra']['foo2']);
$this->assertTrue($records[1]['extra']['foo2']);
}
}
}

View File

@@ -99,6 +99,11 @@ class WhatFailureGroupHandlerTest extends TestCase
return $record;
});
$handler->pushProcessor(function ($record) {
$record['extra']['foo2'] = true;
return $record;
});
$handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
foreach ($testHandlers as $test) {
$this->assertTrue($test->hasDebugRecords());
@@ -107,6 +112,8 @@ class WhatFailureGroupHandlerTest extends TestCase
$records = $test->getRecords();
$this->assertTrue($records[0]['extra']['foo']);
$this->assertTrue($records[1]['extra']['foo']);
$this->assertTrue($records[0]['extra']['foo2']);
$this->assertTrue($records[1]['extra']['foo2']);
}
}