PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
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 / InsightOpsHandler.php

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

58 lines 1.7 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 * Inspired on LogEntriesHandler.
18 *
19 * @author Robert Kaufmann III <[email protected]>
20 * @author Gabriel Machado <[email protected]>
21 */
22 class InsightOpsHandler extends SocketHandler
23 {
24 /**
25 * @var string
26 */
27 protected $logToken;
28
29 /**
30 * @param string $token Log token supplied by InsightOps
31 * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'.
32 * @param bool $useSSL Whether or not SSL encryption should be used
33 *
34 * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
35 */
36 public function __construct(string $token, string $region = 'us', bool $useSSL = true, $level = Logger::DEBUG, bool $bubble = true)
37 {
38 if ($useSSL && !extension_loaded('openssl')) {
39 throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for InsightOpsHandler');
40 }
41
42 $endpoint = $useSSL
43 ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443'
44 : $region . '.data.logs.insight.rapid7.com:80';
45
46 parent::__construct($endpoint, $level, $bubble);
47 $this->logToken = $token;
48 }
49
50 /**
51 * {@inheritDoc}
52 */
53 protected function generateDataStream(array $record): string
54 {
55 return $this->logToken . ' ' . $record['formatted'];
56 }
57 }
58