PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / monolog / monolog / src / Monolog / Handler / LogEntriesHandler.php

LogEntriesHandler.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.7.0, at vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Monolog\Handler;
13
14 use Monolog\Logger;
15
16 /**
17 * @author Robert Kaufmann III <[email protected]>
18 */
19 class LogEntriesHandler extends SocketHandler
20 {
21 /**
22 * @var string
23 */
24 protected $logToken;
25
26 /**
27 * @param string $token Log token supplied by LogEntries
28 * @param bool $useSSL Whether or not SSL encryption should be used.
29 * @param string $host Custom hostname to send the data to if needed
30 *
31 * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
32 */
33 public function __construct(string $token, bool $useSSL = true, $level = Logger::DEBUG, bool $bubble = true, string $host = 'data.logentries.com')
34 {
35 if ($useSSL && !extension_loaded('openssl')) {
36 throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler');
37 }
38
39 $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80';
40 parent::__construct($endpoint, $level, $bubble);
41 $this->logToken = $token;
42 }
43
44 /**
45 * {@inheritDoc}
46 */
47 protected function generateDataStream(array $record): string
48 {
49 return $this->logToken . ' ' . $record['formatted'];
50 }
51 }
52