/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/SamplingHandler.php (3910B)
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Closure; use Monolog\Formatter\FormatterInterface; use Monolog\LogRecord; /** * Sampling handler * * A sampled event stream can be useful for logging high frequency events in * a production environment where you only need an idea of what is happening * and are not concerned with capturing every occurrence. Since the decision to * handle or not handle a particular event is determined randomly, the * resulting sampled log is not guaranteed to contain 1/N of the events that * occurred in the application, but based on the Law of large numbers, it will * tend to be close to this ratio with a large number of attempts. * * @author Bryan Davis * @author Kunal Mehta */ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** * Handler or factory Closure($record, $this) * * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface */ protected Closure|HandlerInterface $handler; protected int $factor; /** * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler * * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $samplingHandler). * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) */ public function __construct(Closure|HandlerInterface $handler, int $factor) { parent::__construct(); $this->handler = $handler; $this->factor = $factor; } public function isHandling(LogRecord $record): bool { return $this->getHandler($record)->isHandling($record); } public function handle(LogRecord $record): bool { if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { if (\count($this->processors) > 0) { $record = $this->processRecord($record); } $this->getHandler($record)->handle($record); } return false === $this->bubble; } /** * Return the nested handler * * If the handler was provided as a factory, this will trigger the handler's instantiation. */ public function getHandler(LogRecord $record = null): HandlerInterface { if (!$this->handler instanceof HandlerInterface) { $handler = ($this->handler)($record, $this); if (!$handler instanceof HandlerInterface) { throw new \RuntimeException("The factory Closure should return a HandlerInterface"); } $this->handler = $handler; } return $this->handler; } /** * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { $handler = $this->getHandler(); if ($handler instanceof 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(): FormatterInterface { $handler = $this->getHandler(); if ($handler instanceof FormattableHandlerInterface) { return $handler->getFormatter(); } throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); } }