1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-29 11:26:09 +01:00

Check if monolog runs in web context (#1024)

* Check if monolog runs in web context
This commit is contained in:
Pascal
2018-06-11 17:36:34 +02:00
committed by Jordi Boggiano
parent ff5ae5cead
commit 5bb1c5fb4f
5 changed files with 41 additions and 1 deletions

View File

@@ -24,6 +24,9 @@ use Monolog\Logger;
*/
class ChromePHPHandler extends AbstractProcessingHandler
{
use WebRequestRecognizerTrait;
/**
* Version of the extension
*/
@@ -75,6 +78,10 @@ class ChromePHPHandler extends AbstractProcessingHandler
*/
public function handleBatch(array $records)
{
if (!$this->isWebRequest()) {
return;
}
$messages = [];
foreach ($records as $record) {
@@ -108,6 +115,10 @@ class ChromePHPHandler extends AbstractProcessingHandler
*/
protected function write(array $record)
{
if (!$this->isWebRequest()) {
return;
}
self::$json['rows'][] = $record['formatted'];
$this->send();