golden hour
/home/doctorbruno/.trash/google-site-kit/third-party/monolog/monolog/src/Monolog/Handler
⬆️ Go Up
Upload
File/Folder
Size
Actions
AbstractHandler.php
2.89 KB
Del
OK
AbstractProcessingHandler.php
2.03 KB
Del
OK
AbstractSyslogHandler.php
3.95 KB
Del
OK
AmqpHandler.php
5.24 KB
Del
OK
BrowserConsoleHandler.php
9.77 KB
Del
OK
BufferHandler.php
5.13 KB
Del
OK
ChromePHPHandler.php
5.56 KB
Del
OK
CouchDBHandler.php
2.19 KB
Del
OK
CubeHandler.php
5.6 KB
Del
OK
Curl
-
Del
OK
DeduplicationHandler.php
6.23 KB
Del
OK
DoctrineCouchDBHandler.php
1.47 KB
Del
OK
DynamoDbHandler.php
2.88 KB
Del
OK
ElasticaHandler.php
3.75 KB
Del
OK
ElasticsearchHandler.php
7.17 KB
Del
OK
ErrorLogHandler.php
2.85 KB
Del
OK
FallbackGroupHandler.php
1.79 KB
Del
OK
FilterHandler.php
7.68 KB
Del
OK
FingersCrossed
-
Del
OK
FingersCrossedHandler.php
9.3 KB
Del
OK
FirePHPHandler.php
5.32 KB
Del
OK
FleepHookHandler.php
3.65 KB
Del
OK
FlowdockHandler.php
3.86 KB
Del
OK
FormattableHandlerInterface.php
1.02 KB
Del
OK
FormattableHandlerTrait.php
1.57 KB
Del
OK
GelfHandler.php
1.72 KB
Del
OK
GroupHandler.php
3.58 KB
Del
OK
Handler.php
1.29 KB
Del
OK
HandlerInterface.php
2.99 KB
Del
OK
HandlerWrapper.php
4.15 KB
Del
OK
IFTTTHandler.php
2.37 KB
Del
OK
InsightOpsHandler.php
2.03 KB
Del
OK
LogEntriesHandler.php
1.88 KB
Del
OK
LogglyHandler.php
4.38 KB
Del
OK
LogmaticHandler.php
2.79 KB
Del
OK
MailHandler.php
2.51 KB
Del
OK
MandrillHandler.php
2.71 KB
Del
OK
MissingExtensionException.php
502 B
Del
OK
MongoDBHandler.php
2.91 KB
Del
OK
NativeMailerHandler.php
5.07 KB
Del
OK
NewRelicHandler.php
6.42 KB
Del
OK
NoopHandler.php
958 B
Del
OK
NullHandler.php
1.51 KB
Del
OK
OverflowHandler.php
5.11 KB
Del
OK
PHPConsoleHandler.php
11.14 KB
Del
OK
ProcessHandler.php
5.17 KB
Del
OK
ProcessableHandlerInterface.php
1.27 KB
Del
OK
ProcessableHandlerTrait.php
1.86 KB
Del
OK
PsrHandler.php
2.8 KB
Del
OK
PushoverHandler.php
7.92 KB
Del
OK
RedisHandler.php
3.21 KB
Del
OK
RedisPubSubHandler.php
2.09 KB
Del
OK
RollbarHandler.php
3.68 KB
Del
OK
RotatingFileHandler.php
6.46 KB
Del
OK
SamplingHandler.php
4.8 KB
Del
OK
SendGridHandler.php
3.04 KB
Del
OK
Slack
-
Del
OK
SlackHandler.php
7.08 KB
Del
OK
SlackWebhookHandler.php
4.19 KB
Del
OK
SocketHandler.php
12.09 KB
Del
OK
SqsHandler.php
1.97 KB
Del
OK
StreamHandler.php
8.57 KB
Del
OK
SwiftMailerHandler.php
4.14 KB
Del
OK
SymfonyMailerHandler.php
4.04 KB
Del
OK
SyslogHandler.php
2.08 KB
Del
OK
SyslogUdp
-
Del
OK
SyslogUdpHandler.php
4.66 KB
Del
OK
TelegramBotHandler.php
8.25 KB
Del
OK
TestHandler.php
6.8 KB
Del
OK
WebRequestRecognizerTrait.php
554 B
Del
OK
WhatFailureGroupHandler.php
1.98 KB
Del
OK
ZendMonitorHandler.php
3.78 KB
Del
OK
Edit: FingersCrossedHandler.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 Google\Site_Kit_Dependencies\Monolog\Handler; use Google\Site_Kit_Dependencies\Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; use Google\Site_Kit_Dependencies\Monolog\Handler\FingersCrossed\ActivationStrategyInterface; use Google\Site_Kit_Dependencies\Monolog\Logger; use Google\Site_Kit_Dependencies\Monolog\ResettableInterface; use Google\Site_Kit_Dependencies\Monolog\Formatter\FormatterInterface; use Google\Site_Kit_Dependencies\Psr\Log\LogLevel; /** * Buffers all records until a certain level is reached * * The advantage of this approach is that you don't get any clutter in your log files. * Only requests which actually trigger an error (or whatever your actionLevel is) will be * in the logs, but they will contain all records, not only those above the level threshold. * * You can then have a passthruLevel as well which means that at the end of the request, * even if it did not get activated, it will still send through log records of e.g. at least a * warning level. * * You can find the various activation strategies in the * Monolog\Handler\FingersCrossed\ namespace. * * @author Jordi Boggiano <j.boggiano@seld.be> * * @phpstan-import-type Record from \Monolog\Logger * @phpstan-import-type Level from \Monolog\Logger * @phpstan-import-type LevelName from \Monolog\Logger */ class FingersCrossedHandler extends \Google\Site_Kit_Dependencies\Monolog\Handler\Handler implements \Google\Site_Kit_Dependencies\Monolog\Handler\ProcessableHandlerInterface, \Google\Site_Kit_Dependencies\Monolog\ResettableInterface, \Google\Site_Kit_Dependencies\Monolog\Handler\FormattableHandlerInterface { use ProcessableHandlerTrait; /** * @var callable|HandlerInterface * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface */ protected $handler; /** @var ActivationStrategyInterface */ protected $activationStrategy; /** @var bool */ protected $buffering = \true; /** @var int */ protected $bufferSize; /** @var Record[] */ protected $buffer = []; /** @var bool */ protected $stopBuffering; /** * @var ?int * @phpstan-var ?Level */ protected $passthruLevel; /** @var bool */ protected $bubble; /** * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler * * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler). * @param int|string|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) * @param int|string $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered * * @phpstan-param Level|LevelName|LogLevel::* $passthruLevel * @phpstan-param Level|LevelName|LogLevel::*|ActivationStrategyInterface $activationStrategy */ public function __construct($handler, $activationStrategy = null, int $bufferSize = 0, bool $bubble = \true, bool $stopBuffering = \true, $passthruLevel = null) { if (null === $activationStrategy) { $activationStrategy = new \Google\Site_Kit_Dependencies\Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy(\Google\Site_Kit_Dependencies\Monolog\Logger::WARNING); } // convert simple int activationStrategy to an object if (!$activationStrategy instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\FingersCrossed\ActivationStrategyInterface) { $activationStrategy = new \Google\Site_Kit_Dependencies\Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy($activationStrategy); } $this->handler = $handler; $this->activationStrategy = $activationStrategy; $this->bufferSize = $bufferSize; $this->bubble = $bubble; $this->stopBuffering = $stopBuffering; if ($passthruLevel !== null) { $this->passthruLevel = \Google\Site_Kit_Dependencies\Monolog\Logger::toMonologLevel($passthruLevel); } if (!$this->handler instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\HandlerInterface && !\is_callable($this->handler)) { throw new \RuntimeException("The given handler (" . \json_encode($this->handler) . ") is not a callable nor a Monolog\\Handler\\HandlerInterface object"); } } /** * {@inheritDoc} */ public function isHandling(array $record) : bool { return \true; } /** * Manually activate this logger regardless of the activation strategy */ public function activate() : void { if ($this->stopBuffering) { $this->buffering = \false; } $this->getHandler(\end($this->buffer) ?: null)->handleBatch($this->buffer); $this->buffer = []; } /** * {@inheritDoc} */ public function handle(array $record) : bool { if ($this->processors) { /** @var Record $record */ $record = $this->processRecord($record); } if ($this->buffering) { $this->buffer[] = $record; if ($this->bufferSize > 0 && \count($this->buffer) > $this->bufferSize) { \array_shift($this->buffer); } if ($this->activationStrategy->isHandlerActivated($record)) { $this->activate(); } } else { $this->getHandler($record)->handle($record); } return \false === $this->bubble; } /** * {@inheritDoc} */ public function close() : void { $this->flushBuffer(); $this->getHandler()->close(); } public function reset() { $this->flushBuffer(); $this->resetProcessors(); if ($this->getHandler() instanceof \Google\Site_Kit_Dependencies\Monolog\ResettableInterface) { $this->getHandler()->reset(); } } /** * Clears the buffer without flushing any messages down to the wrapped handler. * * It also resets the handler to its initial buffering state. */ public function clear() : void { $this->buffer = []; $this->reset(); } /** * Resets the state of the handler. Stops forwarding records to the wrapped handler. */ private function flushBuffer() : void { if (null !== $this->passthruLevel) { $level = $this->passthruLevel; $this->buffer = \array_filter($this->buffer, function ($record) use($level) { return $record['level'] >= $level; }); if (\count($this->buffer) > 0) { $this->getHandler(\end($this->buffer))->handleBatch($this->buffer); } } $this->buffer = []; $this->buffering = \true; } /** * Return the nested handler * * If the handler was provided as a factory callable, this will trigger the handler's instantiation. * * @return HandlerInterface * * @phpstan-param Record $record */ public function getHandler(?array $record = null) { if (!$this->handler instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\HandlerInterface) { $this->handler = ($this->handler)($record, $this); if (!$this->handler instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\HandlerInterface) { throw new \RuntimeException("The factory callable should return a HandlerInterface"); } } return $this->handler; } /** * {@inheritDoc} */ public function setFormatter(\Google\Site_Kit_Dependencies\Monolog\Formatter\FormatterInterface $formatter) : \Google\Site_Kit_Dependencies\Monolog\Handler\HandlerInterface { $handler = $this->getHandler(); if ($handler instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\FormattableHandlerInterface) { $handler->setFormatter($formatter); return $this; } throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.'); } /** * {@inheritDoc} */ public function getFormatter() : \Google\Site_Kit_Dependencies\Monolog\Formatter\FormatterInterface { $handler = $this->getHandler(); if ($handler instanceof \Google\Site_Kit_Dependencies\Monolog\Handler\FormattableHandlerInterface) { return $handler->getFormatter(); } throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.'); } }
Save