mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 09:36:11 +02:00
Check if monolog runs in web context (#1024)
* Check if monolog runs in web context
This commit is contained in:
16
src/Monolog/Handler/WebRequestRecognizerTrait.php
Normal file
16
src/Monolog/Handler/WebRequestRecognizerTrait.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Monolog\Handler;
|
||||
|
||||
trait WebRequestRecognizerTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks if PHP's serving a web request
|
||||
* @return bool
|
||||
*/
|
||||
protected function isWebRequest(): bool
|
||||
{
|
||||
return 'cli' !== \PHP_SAPI && 'phpdbg' !== \PHP_SAPI;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user