File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/monolog/monolog/src/Monolog/Handler
Upload
[..]
AbstractHandler.php (2.61 KB)
Edit
Rename
Del
AmqpHandler.php (4.95 KB)
Edit
Rename
Del
BrowserConsoleHandler.php (9.02 KB)
Edit
Rename
Del
BufferHandler.php (4.55 KB)
Edit
Rename
Del
ChromePHPHandler.php (4.79 KB)
Edit
Rename
Del
CouchDBHandler.php (2.55 KB)
Edit
Rename
Del
CubeHandler.php (5.31 KB)
Edit
Rename
Del
Curl/
Rename
Del
DeduplicationHandler.php (6.29 KB)
Edit
Rename
Del
DoctrineCouchDBHandler.php (1.12 KB)
Edit
Rename
Del
DynamoDbHandler.php (1.89 KB)
Edit
Rename
Del
ElasticaHandler.php (3.66 KB)
Edit
Rename
Del
ElasticsearchHandler.php (7.1 KB)
Edit
Rename
Del
ErrorLogHandler.php (2.61 KB)
Edit
Rename
Del
FilterHandler.php (6.92 KB)
Edit
Rename
Del
FingersCrossed/
Rename
Del
FingersCrossedHandler.php (7.99 KB)
Edit
Rename
Del
FirePHPHandler.php (5.03 KB)
Edit
Rename
Del
FleepHookHandler.php (3.44 KB)
Edit
Rename
Del
FlowdockHandler.php (3.4 KB)
Edit
Rename
Del
GelfHandler.php (1.42 KB)
Edit
Rename
Del
GroupHandler.php (3.19 KB)
Edit
Rename
Del
Handler.php (1015 B)
Edit
Rename
Del
HandlerInterface.php (2.71 KB)
Edit
Rename
Del
HandlerWrapper.php (3.28 KB)
Edit
Rename
Del
IFTTTHandler.php (2.22 KB)
Edit
Rename
Del
InsightOpsHandler.php (2.04 KB)
Edit
Rename
Del
LogEntriesHandler.php (1.86 KB)
Edit
Rename
Del
LogglyHandler.php (4.01 KB)
Edit
Rename
Del
LogmaticHandler.php (2.57 KB)
Edit
Rename
Del
MailHandler.php (2.19 KB)
Edit
Rename
Del
MandrillHandler.php (2.48 KB)
Edit
Rename
Del
NativeMailerHandler.php (5.08 KB)
Edit
Rename
Del
NewRelicHandler.php (5.7 KB)
Edit
Rename
Del
NoopHandler.php (908 B)
Edit
Rename
Del
OverflowHandler.php (4.21 KB)
Edit
Rename
Del
PHPConsoleHandler.php (12.01 KB)
Edit
Rename
Del
PsrHandler.php (2.41 KB)
Edit
Rename
Del
RedisHandler.php (2.67 KB)
Edit
Rename
Del
RollbarHandler.php (3.48 KB)
Edit
Rename
Del
SendGridHandler.php (3.02 KB)
Edit
Rename
Del
Slack/
Rename
Del
SocketHandler.php (11.84 KB)
Edit
Rename
Del
SqsHandler.php (1.71 KB)
Edit
Rename
Del
StreamHandler.php (8.74 KB)
Edit
Rename
Del
SymfonyMailerHandler.php (3.45 KB)
Edit
Rename
Del
SyslogHandler.php (1.65 KB)
Edit
Rename
Del
SyslogUdp/
Rename
Del
SyslogUdpHandler.php (4.6 KB)
Edit
Rename
Del
TelegramBotHandler.php (9.29 KB)
Edit
Rename
Del
TestHandler.php (6.73 KB)
Edit
Rename
Del
WebRequestRecognizerTrait.php (504 B)
Edit
Rename
Del
ZendMonitorHandler.php (2.78 KB)
Edit
Rename
Del
Edit: BufferHandler.php
<?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\Level; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; use Monolog\LogRecord; /** * Buffers all records until closing the handler and then pass them as batch. * * This is useful for a MailHandler to send only one mail per request instead of * sending one per log message. * * @author Christophe Coevoet <stof@notk.org> */ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; protected HandlerInterface $handler; protected int $bufferSize = 0; protected int $bufferLimit; protected bool $flushOnOverflow; /** @var LogRecord[] */ protected array $buffer = []; protected bool $initialized = false; /** * @param HandlerInterface $handler Handler. * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ public function __construct(HandlerInterface $handler, int $bufferLimit = 0, int|string|Level $level = Level::Debug, bool $bubble = true, bool $flushOnOverflow = false) { parent::__construct($level, $bubble); $this->handler = $handler; $this->bufferLimit = $bufferLimit; $this->flushOnOverflow = $flushOnOverflow; } /** * @inheritDoc */ public function handle(LogRecord $record): bool { if ($record->level->isLowerThan($this->level)) { return false; } if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors register_shutdown_function([$this, 'close']); $this->initialized = true; } if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) { if ($this->flushOnOverflow) { $this->flush(); } else { array_shift($this->buffer); $this->bufferSize--; } } if (\count($this->processors) > 0) { $record = $this->processRecord($record); } $this->buffer[] = $record; $this->bufferSize++; return false === $this->bubble; } public function flush(): void { if ($this->bufferSize === 0) { return; } $this->handler->handleBatch($this->buffer); $this->clear(); } public function __destruct() { // suppress the parent behavior since we already have register_shutdown_function() // to call close(), and the reference contained there will prevent this from being // GC'd until the end of the request } /** * @inheritDoc */ public function close(): void { $this->flush(); $this->handler->close(); } /** * Clears the buffer without flushing any messages down to the wrapped handler. */ public function clear(): void { $this->bufferSize = 0; $this->buffer = []; } public function reset(): void { $this->flush(); parent::reset(); $this->resetProcessors(); if ($this->handler instanceof ResettableInterface) { $this->handler->reset(); } } /** * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { if ($this->handler instanceof FormattableHandlerInterface) { $this->handler->setFormatter($formatter); return $this; } throw new \UnexpectedValueException('The nested handler of type '.\get_class($this->handler).' does not support formatters.'); } /** * @inheritDoc */ public function getFormatter(): FormatterInterface { if ($this->handler instanceof FormattableHandlerInterface) { return $this->handler->getFormatter(); } throw new \UnexpectedValueException('The nested handler of type '.\get_class($this->handler).' does not support formatters.'); } public function setHandler(HandlerInterface $handler): void { $this->handler = $handler; } }
Simpan