/
home
/
techb158
/
dev.balacoffee.com
/
vendor
/
monolog
/
monolog
/
src
/
Monolog
/
Handler
/
/home/techb158/dev.balacoffee.com/vendor/monolog/monolog/src/Monolog/Handler
mkdir
upload
Name
Size
Mode
Actions
Curl/
-
0755
rm
FingersCrossed/
-
0755
rm
Slack/
-
0755
rm
SyslogUdp/
-
0755
rm
AbstractHandler.php
2651
0644
edit
dl
rm
AbstractProcessingHandler.php
1914
0644
edit
dl
rm
AbstractSyslogHandler.php
3540
0644
edit
dl
rm
AmqpHandler.php
5101
0644
edit
dl
rm
BrowserConsoleHandler.php
9501
0644
edit
dl
rm
BufferHandler.php
4644
0644
edit
dl
rm
ChromePHPHandler.php
5250
0644
edit
dl
rm
CouchDBHandler.php
2103
0644
edit
dl
rm
CubeHandler.php
5399
0644
edit
dl
rm
DeduplicationHandler.php
6063
0644
edit
dl
rm
DoctrineCouchDBHandler.php
1128
0644
edit
dl
rm
DynamoDbHandler.php
2482
0644
edit
dl
rm
ElasticaHandler.php
3328
0644
edit
dl
rm
ElasticsearchHandler.php
6511
0644
edit
dl
rm
ErrorLogHandler.php
2587
0644
edit
dl
rm
FallbackGroupHandler.php
1761
0644
edit
dl
rm
FilterHandler.php
6863
0644
edit
dl
rm
FingersCrossedHandler.php
8469
0644
edit
dl
rm
FirePHPHandler.php
5288
0644
edit
dl
rm
FleepHookHandler.php
3593
0644
edit
dl
rm
FlowdockHandler.php
3622
0644
edit
dl
rm
FormattableHandlerInterface.php
845
0644
edit
dl
rm
FormattableHandlerTrait.php
1281
0644
edit
dl
rm
GelfHandler.php
1399
0644
edit
dl
rm
GroupHandler.php
3234
0644
edit
dl
rm
Handler.php
1247
0644
edit
dl
rm
HandlerInterface.php
3032
0644
edit
dl
rm
HandlerWrapper.php
3358
0644
edit
dl
rm
IFTTTHandler.php
2183
0644
edit
dl
rm
InsightOpsHandler.php
2106
0644
edit
dl
rm
LogEntriesHandler.php
1925
0644
edit
dl
rm
LogglyHandler.php
4098
0644
edit
dl
rm
LogmaticHandler.php
2716
0644
edit
dl
rm
MailHandler.php
2341
0644
edit
dl
rm
MandrillHandler.php
2473
0644
edit
dl
rm
MissingExtensionException.php
473
0644
edit
dl
rm
MongoDBHandler.php
2545
0644
edit
dl
rm
NativeMailerHandler.php
4971
0644
edit
dl
rm
NewRelicHandler.php
6211
0644
edit
dl
rm
NoopHandler.php
880
0644
edit
dl
rm
NullHandler.php
1337
0644
edit
dl
rm
OverflowHandler.php
4533
0644
edit
dl
rm
PHPConsoleHandler.php
10540
0644
edit
dl
rm
ProcessableHandlerInterface.php
1197
0644
edit
dl
rm
ProcessableHandlerTrait.php
1737
0644
edit
dl
rm
ProcessHandler.php
5215
0644
edit
dl
rm
PsrHandler.php
2440
0644
edit
dl
rm
PushoverHandler.php
8085
0644
edit
dl
rm
RedisHandler.php
3020
0644
edit
dl
rm
RedisPubSubHandler.php
1820
0644
edit
dl
rm
RollbarHandler.php
3412
0644
edit
dl
rm
RotatingFileHandler.php
6389
0644
edit
dl
rm
SamplingHandler.php
4338
0644
edit
dl
rm
SendGridHandler.php
2871
0644
edit
dl
rm
SlackHandler.php
7020
0644
edit
dl
rm
SlackWebhookHandler.php
3923
0644
edit
dl
rm
SocketHandler.php
12283
0644
edit
dl
rm
SqsHandler.php
1746
0644
edit
dl
rm
StreamHandler.php
7062
0644
edit
dl
rm
SwiftMailerHandler.php
3669
0644
edit
dl
rm
SymfonyMailerHandler.php
3533
0644
edit
dl
rm
SyslogHandler.php
1907
0644
edit
dl
rm
SyslogUdpHandler.php
4497
0644
edit
dl
rm
TelegramBotHandler.php
8414
0644
edit
dl
rm
TestHandler.php
6750
0644
edit
dl
rm
WebRequestRecognizerTrait.php
524
0644
edit
dl
rm
WhatFailureGroupHandler.php
1949
0644
edit
dl
rm
ZendMonitorHandler.php
3137
0644
edit
dl
rm
Edit:
/home/techb158/dev.balacoffee.com/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php
(5215B)
<?php declare(strict_types=1); /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Stores to STDIN of any process, specified by a command. * * Usage example: * <pre> * $log = new Logger('myLogger'); * $log->pushHandler(new ProcessHandler('/usr/bin/php /var/www/monolog/someScript.php')); * </pre> * * @author Kolja Zuelsdorf <koljaz@web.de> */ class ProcessHandler extends AbstractProcessingHandler { /** * Holds the process to receive data on its STDIN. * * @var resource|bool|null */ private $process; /** * @var string */ private $command; /** * @var string|null */ private $cwd; /** * @var resource[] */ private $pipes = []; /** * @var array<int, string[]> */ 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, $level = Logger::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(array $record): void { $this->ensureProcessIsStarted(); $this->writeProcessInput($record['formatted']); $errors = $this->readProcessErrors(); if (empty($errors) === false) { 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 || empty($errors) === false) { 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; } } }
Save
cmd:
run