/var/www/vhosts/ihelp.ro/httpdocs/vendor/monolog/monolog/src/Monolog/Handler
NameSizeModeActions
Curl/-0755rm
FingersCrossed/-0755rm
Slack/-0755rm
SyslogUdp/-0755rm
AbstractHandler.php26370644editdlrm
AbstractProcessingHandler.php14990644editdlrm
AbstractSyslogHandler.php32210644editdlrm
AmqpHandler.php48130644editdlrm
BrowserConsoleHandler.php92370644editdlrm
BufferHandler.php45460644editdlrm
ChromePHPHandler.php51370644editdlrm
CouchDBHandler.php26100644editdlrm
CubeHandler.php54380644editdlrm
DeduplicationHandler.php59420644editdlrm
DoctrineCouchDBHandler.php11500644editdlrm
DynamoDbHandler.php19340644editdlrm
ElasticaHandler.php36700644editdlrm
ElasticsearchHandler.php69530644editdlrm
ErrorLogHandler.php26760644editdlrm
FallbackGroupHandler.php16720644editdlrm
FilterHandler.php71180644editdlrm
FingersCrossedHandler.php82010644editdlrm
FirePHPHandler.php51530644editdlrm
FleepHookHandler.php35230644editdlrm
FlowdockHandler.php34800644editdlrm
FormattableHandlerInterface.php7570644editdlrm
FormattableHandlerTrait.php12680644editdlrm
GelfHandler.php14540644editdlrm
GroupHandler.php32220644editdlrm
Handler.php12430644editdlrm
HandlerInterface.php27860644editdlrm
HandlerWrapper.php33550644editdlrm
IFTTTHandler.php22680644editdlrm
InsightOpsHandler.php20870644editdlrm
LogEntriesHandler.php19060644editdlrm
LogglyHandler.php40870644editdlrm
LogmaticHandler.php26330644editdlrm
MailHandler.php22450644editdlrm
MandrillHandler.php25340644editdlrm
MissingExtensionException.php4730644editdlrm
MongoDBHandler.php23640644editdlrm
NativeMailerHandler.php48970644editdlrm
NewRelicHandler.php58310644editdlrm
NoopHandler.php9080644editdlrm
NullHandler.php13310644editdlrm
OverflowHandler.php43090644editdlrm
PHPConsoleHandler.php122090644editdlrm
ProcessableHandlerInterface.php11850644editdlrm
ProcessableHandlerTrait.php16180644editdlrm
ProcessHandler.php51790644editdlrm
PsrHandler.php23550644editdlrm
PushoverHandler.php80570644editdlrm
RedisHandler.php27410644editdlrm
RedisPubSubHandler.php16830644editdlrm
RollbarHandler.php36010644editdlrm
RotatingFileHandler.php69330644editdlrm
SamplingHandler.php39100644editdlrm
SendGridHandler.php29360644editdlrm
SlackHandler.php69300644editdlrm
SlackWebhookHandler.php39880644editdlrm
SocketHandler.php119950644editdlrm
SqsHandler.php17480644editdlrm
StreamHandler.php65640644editdlrm
SymfonyMailerHandler.php35490644editdlrm
SyslogHandler.php17060644editdlrm
SyslogUdpHandler.php47060644editdlrm
TelegramBotHandler.php89820644editdlrm
TestHandler.php64620644editdlrm
WebRequestRecognizerTrait.php5040644editdlrm
WhatFailureGroupHandler.php18630644editdlrm
ZendMonitorHandler.php28500644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php (5179B)
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Level; use Monolog\LogRecord; /** * Stores to STDIN of any process, specified by a command. * * Usage example: *
 * $log = new Logger('myLogger');
 * $log->pushHandler(new ProcessHandler('/usr/bin/php /var/www/monolog/someScript.php'));
 * 
* * @author Kolja Zuelsdorf */ class ProcessHandler extends AbstractProcessingHandler { /** * Holds the process to receive data on its STDIN. * * @var resource|bool|null */ private $process; private string $command; private ?string $cwd; /** * @var resource[] */ private array $pipes = []; /** * @var array */ protected const DESCRIPTOR_SPEC = [ 0 => ['pipe', 'r'], // STDIN is a pipe that the child will read from 1 => ['pipe', 'w'], // STDOUT is a pipe that the child will write to 2 => ['pipe', 'w'], // STDERR is a pipe to catch the any errors ]; /** * @param string $command Command for the process to start. Absolute paths are recommended, * especially if you do not use the $cwd parameter. * @param string|null $cwd "Current working directory" (CWD) for the process to be executed in. * @throws \InvalidArgumentException */ public function __construct(string $command, int|string|Level $level = Level::Debug, bool $bubble = true, ?string $cwd = null) { if ($command === '') { throw new \InvalidArgumentException('The command argument must be a non-empty string.'); } if ($cwd === '') { throw new \InvalidArgumentException('The optional CWD argument must be a non-empty string or null.'); } parent::__construct($level, $bubble); $this->command = $command; $this->cwd = $cwd; } /** * Writes the record down to the log of the implementing handler * * @throws \UnexpectedValueException */ protected function write(LogRecord $record): void { $this->ensureProcessIsStarted(); $this->writeProcessInput($record->formatted); $errors = $this->readProcessErrors(); if ($errors !== '') { throw new \UnexpectedValueException(sprintf('Errors while writing to process: %s', $errors)); } } /** * Makes sure that the process is actually started, and if not, starts it, * assigns the stream pipes, and handles startup errors, if any. */ private function ensureProcessIsStarted(): void { if (is_resource($this->process) === false) { $this->startProcess(); $this->handleStartupErrors(); } } /** * Starts the actual process and sets all streams to non-blocking. */ private function startProcess(): void { $this->process = proc_open($this->command, static::DESCRIPTOR_SPEC, $this->pipes, $this->cwd); foreach ($this->pipes as $pipe) { stream_set_blocking($pipe, false); } } /** * Selects the STDERR stream, handles upcoming startup errors, and throws an exception, if any. * * @throws \UnexpectedValueException */ private function handleStartupErrors(): void { $selected = $this->selectErrorStream(); if (false === $selected) { throw new \UnexpectedValueException('Something went wrong while selecting a stream.'); } $errors = $this->readProcessErrors(); if (is_resource($this->process) === false || $errors !== '') { throw new \UnexpectedValueException( sprintf('The process "%s" could not be opened: ' . $errors, $this->command) ); } } /** * Selects the STDERR stream. * * @return int|bool */ protected function selectErrorStream() { $empty = []; $errorPipes = [$this->pipes[2]]; return stream_select($errorPipes, $empty, $empty, 1); } /** * Reads the errors of the process, if there are any. * * @codeCoverageIgnore * @return string Empty string if there are no errors. */ protected function readProcessErrors(): string { return (string) stream_get_contents($this->pipes[2]); } /** * Writes to the input stream of the opened process. * * @codeCoverageIgnore */ protected function writeProcessInput(string $string): void { fwrite($this->pipes[0], $string); } /** * @inheritDoc */ public function close(): void { if (is_resource($this->process)) { foreach ($this->pipes as $pipe) { fclose($pipe); } proc_close($this->process); $this->process = null; } } }