/home/techb158/ileadtechnology.com/SSM/vendor/monolog/monolog/src/Monolog/Handler
NameSizeModeActions
Curl/-0755rm
FingersCrossed/-0755rm
Slack/-0755rm
SyslogUdp/-0755rm
AbstractHandler.php22870644editdlrm
AbstractProcessingHandler.php14330644editdlrm
AbstractSyslogHandler.php35840644editdlrm
AmqpHandler.php40380644editdlrm
BrowserConsoleHandler.php76220644editdlrm
BufferHandler.php42010644editdlrm
ChromePHPHandler.php52050644editdlrm
CouchDBHandler.php20320644editdlrm
CubeHandler.php48490644editdlrm
DeduplicationHandler.php56950644editdlrm
DoctrineCouchDBHandler.php10980644editdlrm
DynamoDbHandler.php23740644editdlrm
ElasticaHandler.php33850644editdlrm
ElasticsearchHandler.php54700644editdlrm
ErrorLogHandler.php25120644editdlrm
FallbackGroupHandler.php13840644editdlrm
FilterHandler.php53710644editdlrm
FingersCrossedHandler.php71120644editdlrm
FirePHPHandler.php48970644editdlrm
FleepHookHandler.php33190644editdlrm
FlowdockHandler.php32540644editdlrm
FormattableHandlerInterface.php8450644editdlrm
FormattableHandlerTrait.php13200644editdlrm
GelfHandler.php16220644editdlrm
GroupHandler.php29570644editdlrm
Handler.php10290644editdlrm
HandlerInterface.php27780644editdlrm
HandlerWrapper.php33380644editdlrm
IFTTTHandler.php21950644editdlrm
InsightOpsHandler.php18950644editdlrm
LogEntriesHandler.php17140644editdlrm
LogglyHandler.php41860644editdlrm
LogmaticHandler.php25020644editdlrm
MailHandler.php20660644editdlrm
MandrillHandler.php24860644editdlrm
MissingExtensionException.php4730644editdlrm
MongoDBHandler.php26720644editdlrm
NativeMailerHandler.php51650644editdlrm
NewRelicHandler.php63660644editdlrm
NoopHandler.php8800644editdlrm
NullHandler.php11420644editdlrm
OverflowHandler.php44260644editdlrm
PHPConsoleHandler.php102680644editdlrm
ProcessableHandlerInterface.php9480644editdlrm
ProcessableHandlerTrait.php15340644editdlrm
ProcessHandler.php54230644editdlrm
PsrHandler.php26510644editdlrm
PushoverHandler.php70250644editdlrm
RedisHandler.php30050644editdlrm
RollbarHandler.php35500644editdlrm
RotatingFileHandler.php61410644editdlrm
SamplingHandler.php34230644editdlrm
SendGridHandler.php29040644editdlrm
SlackHandler.php66680644editdlrm
SlackWebhookHandler.php40290644editdlrm
SocketHandler.php99210644editdlrm
SqsHandler.php17830644editdlrm
StreamHandler.php53700644editdlrm
SwiftMailerHandler.php31950644editdlrm
SyslogHandler.php20030644editdlrm
SyslogUdpHandler.php35810644editdlrm
TelegramBotHandler.php27800644editdlrm
TestHandler.php56840644editdlrm
WebRequestRecognizerTrait.php5240644editdlrm
WhatFailureGroupHandler.php15330644editdlrm
ZendMonitorHandler.php31730644editdlrm
Edit: /home/techb158/ileadtechnology.com/SSM/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php (5370B)
* * 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 any stream resource * * Can be used to store into php://stderr, remote and local files, etc. * * @author Jordi Boggiano */ class StreamHandler extends AbstractProcessingHandler { /** @var resource|null */ protected $stream; protected $url; /** @var string|null */ private $errorMessage; protected $filePermission; protected $useLocking; private $dirCreated; /** * @param resource|string $stream If a missing path can't be created, an UnexpectedValueException will be thrown on first write * @param string|int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param bool $useLocking Try to lock log file before doing any writes * * @throws \InvalidArgumentException If stream is not a resource or string */ public function __construct($stream, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { parent::__construct($level, $bubble); if (is_resource($stream)) { $this->stream = $stream; } elseif (is_string($stream)) { $this->url = $stream; } else { throw new \InvalidArgumentException('A stream must either be a resource or a string.'); } $this->filePermission = $filePermission; $this->useLocking = $useLocking; } /** * {@inheritdoc} */ public function close(): void { if ($this->url && is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; $this->dirCreated = null; } /** * Return the currently active stream if it is open * * @return resource|null */ public function getStream() { return $this->stream; } /** * Return the stream URL if it was configured with a URL and not an active resource * * @return string|null */ public function getUrl(): ?string { return $this->url; } /** * {@inheritdoc} */ protected function write(array $record): void { if (!is_resource($this->stream)) { if (null === $this->url || '' === $this->url) { throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); } $this->createDir(); $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); $this->stream = fopen($this->url, 'a'); if ($this->filePermission !== null) { @chmod($this->url, $this->filePermission); } restore_error_handler(); if (!is_resource($this->stream)) { $this->stream = null; throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url)); } } if ($this->useLocking) { // ignoring errors here, there's not much we can do about them flock($this->stream, LOCK_EX); } $this->streamWrite($this->stream, $record); if ($this->useLocking) { flock($this->stream, LOCK_UN); } } /** * Write to stream * @param resource $stream * @param array $record */ protected function streamWrite($stream, array $record): void { fwrite($stream, (string) $record['formatted']); } private function customErrorHandler($code, $msg): bool { $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); return true; } private function getDirFromStream(string $stream): ?string { $pos = strpos($stream, '://'); if ($pos === false) { return dirname($stream); } if ('file://' === substr($stream, 0, 7)) { return dirname(substr($stream, 7)); } return null; } private function createDir(): void { // Do not try to create dir if it has already been tried. if ($this->dirCreated) { return; } $dir = $this->getDirFromStream($this->url); if (null !== $dir && !is_dir($dir)) { $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); $status = mkdir($dir, 0777, true); restore_error_handler(); if (false === $status && !is_dir($dir)) { throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir)); } } $this->dirCreated = true; } }