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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user