1
0
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:
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

@@ -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;
}
}