4 * This file is part of the Monolog package.
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Monolog\Handler;
17 * @author Robert Kaufmann III <rok3@rok3.me>
19 class LogEntriesHandler extends SocketHandler
27 * @param string $token Log token supplied by LogEntries
28 * @param bool $useSSL Whether or not SSL encryption should be used.
29 * @param int $level The minimum logging level to trigger this handler
30 * @param bool $bubble Whether or not messages that are handled should bubble up the stack.
32 * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
34 public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true)
36 if ($useSSL && !extension_loaded('openssl')) {
37 throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler');
40 $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80';
41 parent::__construct($endpoint, $level, $bubble);
42 $this->logToken = $token;
48 * @param array $record
51 protected function generateDataStream($record)
53 return $this->logToken . ' ' . $record['formatted'];