golden hour
/home/doctorbruno/.trash/google-site-kit.1/third-party/monolog/monolog/src/Monolog/Handler
⬆️ Go Up
Upload
File/Folder
Size
Actions
AbstractHandler.php
2.69 KB
Del
OK
AbstractProcessingHandler.php
1.89 KB
Del
OK
AbstractSyslogHandler.php
3.47 KB
Del
OK
AmqpHandler.php
4.86 KB
Del
OK
BrowserConsoleHandler.php
9.17 KB
Del
OK
BufferHandler.php
4.64 KB
Del
OK
ChromePHPHandler.php
5.1 KB
Del
OK
CouchDBHandler.php
1.96 KB
Del
OK
CubeHandler.php
5.29 KB
Del
OK
Curl
-
Del
OK
DeduplicationHandler.php
5.99 KB
Del
OK
DoctrineCouchDBHandler.php
1.24 KB
Del
OK
DynamoDbHandler.php
2.61 KB
Del
OK
ElasticaHandler.php
3.34 KB
Del
OK
ElasticsearchHandler.php
6.39 KB
Del
OK
ErrorLogHandler.php
2.63 KB
Del
OK
FallbackGroupHandler.php
1.75 KB
Del
OK
FilterHandler.php
6.86 KB
Del
OK
FingersCrossed
-
Del
OK
FingersCrossedHandler.php
8.46 KB
Del
OK
FirePHPHandler.php
5.15 KB
Del
OK
FleepHookHandler.php
3.42 KB
Del
OK
FlowdockHandler.php
3.5 KB
Del
OK
FormattableHandlerInterface.php
901 B
Del
OK
FormattableHandlerTrait.php
1.33 KB
Del
OK
GelfHandler.php
1.5 KB
Del
OK
GroupHandler.php
3.23 KB
Del
OK
Handler.php
1.24 KB
Del
OK
HandlerInterface.php
2.99 KB
Del
OK
HandlerWrapper.php
3.35 KB
Del
OK
IFTTTHandler.php
2.15 KB
Del
OK
InsightOpsHandler.php
1.9 KB
Del
OK
LogEntriesHandler.php
1.75 KB
Del
OK
LogglyHandler.php
4.1 KB
Del
OK
LogmaticHandler.php
2.57 KB
Del
OK
MailHandler.php
2.36 KB
Del
OK
MandrillHandler.php
2.48 KB
Del
OK
MissingExtensionException.php
502 B
Del
OK
MongoDBHandler.php
2.77 KB
Del
OK
NativeMailerHandler.php
4.92 KB
Del
OK
NewRelicHandler.php
6.14 KB
Del
OK
NoopHandler.php
910 B
Del
OK
NullHandler.php
1.39 KB
Del
OK
OverflowHandler.php
4.4 KB
Del
OK
PHPConsoleHandler.php
10.52 KB
Del
OK
ProcessHandler.php
5.07 KB
Del
OK
ProcessableHandlerInterface.php
1.22 KB
Del
OK
ProcessableHandlerTrait.php
1.77 KB
Del
OK
PsrHandler.php
2.49 KB
Del
OK
PushoverHandler.php
7.57 KB
Del
OK
RedisHandler.php
3.06 KB
Del
OK
RedisPubSubHandler.php
1.91 KB
Del
OK
RollbarHandler.php
3.26 KB
Del
OK
RotatingFileHandler.php
6.31 KB
Del
OK
SamplingHandler.php
4.29 KB
Del
OK
SendGridHandler.php
2.86 KB
Del
OK
Slack
-
Del
OK
SlackHandler.php
6.65 KB
Del
OK
SlackWebhookHandler.php
3.73 KB
Del
OK
SocketHandler.php
11.96 KB
Del
OK
SqsHandler.php
1.78 KB
Del
OK
StreamHandler.php
8.22 KB
Del
OK
SwiftMailerHandler.php
3.8 KB
Del
OK
SymfonyMailerHandler.php
3.63 KB
Del
OK
SyslogHandler.php
1.95 KB
Del
OK
SyslogUdp
-
Del
OK
SyslogUdpHandler.php
4.37 KB
Del
OK
TelegramBotHandler.php
8.08 KB
Del
OK
TestHandler.php
6.67 KB
Del
OK
WebRequestRecognizerTrait.php
553 B
Del
OK
WhatFailureGroupHandler.php
1.93 KB
Del
OK
ZendMonitorHandler.php
3.21 KB
Del
OK
Edit: LogglyHandler.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\Logger; use Google\Site_Kit_Dependencies\Monolog\Formatter\FormatterInterface; use Google\Site_Kit_Dependencies\Monolog\Formatter\LogglyFormatter; use function array_key_exists; use CurlHandle; /** * Sends errors to Loggly. * * @author Przemek Sobstel <przemek@sobstel.org> * @author Adam Pancutt <adam@pancutt.com> * @author Gregory Barchard <gregory@barchard.net> */ class LogglyHandler extends AbstractProcessingHandler { protected const HOST = 'logs-01.loggly.com'; protected const ENDPOINT_SINGLE = 'inputs'; protected const ENDPOINT_BATCH = 'bulk'; /** * Caches the curl handlers for every given endpoint. * * @var resource[]|CurlHandle[] */ protected $curlHandlers = []; /** @var string */ protected $token; /** @var string[] */ protected $tag = []; /** * @param string $token API token supplied by Loggly * * @throws MissingExtensionException If the curl extension is missing */ public function __construct(string $token, $level = Logger::DEBUG, bool $bubble = \true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the LogglyHandler'); } $this->token = $token; parent::__construct($level, $bubble); } /** * Loads and returns the shared curl handler for the given endpoint. * * @param string $endpoint * * @return resource|CurlHandle */ protected function getCurlHandler(string $endpoint) { if (!array_key_exists($endpoint, $this->curlHandlers)) { $this->curlHandlers[$endpoint] = $this->loadCurlHandle($endpoint); } return $this->curlHandlers[$endpoint]; } /** * Starts a fresh curl session for the given endpoint and returns its handler. * * @param string $endpoint * * @return resource|CurlHandle */ private function loadCurlHandle(string $endpoint) { $url = sprintf("https://%s/%s/%s/", static::HOST, $endpoint, $this->token); $ch = curl_init(); curl_setopt($ch, \CURLOPT_URL, $url); curl_setopt($ch, \CURLOPT_POST, \true); curl_setopt($ch, \CURLOPT_RETURNTRANSFER, \true); return $ch; } /** * @param string[]|string $tag */ public function setTag($tag): self { $tag = !empty($tag) ? $tag : []; $this->tag = is_array($tag) ? $tag : [$tag]; return $this; } /** * @param string[]|string $tag */ public function addTag($tag): self { if (!empty($tag)) { $tag = is_array($tag) ? $tag : [$tag]; $this->tag = array_unique(array_merge($this->tag, $tag)); } return $this; } protected function write(array $record): void { $this->send($record["formatted"], static::ENDPOINT_SINGLE); } public function handleBatch(array $records): void { $level = $this->level; $records = array_filter($records, function ($record) use ($level) { return $record['level'] >= $level; }); if ($records) { $this->send($this->getFormatter()->formatBatch($records), static::ENDPOINT_BATCH); } } protected function send(string $data, string $endpoint): void { $ch = $this->getCurlHandler($endpoint); $headers = ['Content-Type: application/json']; if (!empty($this->tag)) { $headers[] = 'X-LOGGLY-TAG: ' . implode(',', $this->tag); } curl_setopt($ch, \CURLOPT_POSTFIELDS, $data); curl_setopt($ch, \CURLOPT_HTTPHEADER, $headers); Curl\Util::execute($ch, 5, \false); } protected function getDefaultFormatter(): FormatterInterface { return new LogglyFormatter(); } }
Save