diff --git a/composer.json b/composer.json index da9e333..76dcb2d 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "cbschuld/logentries", + "name": "michabbb/logentries", "version": "1.0.4", "description": "A PHP PSR-3 compliant logging class for LogEntries service (https://logentries.com/)", "keywords": [ diff --git a/src/LogEntries.php b/src/LogEntries.php index 0af017f..4a18146 100644 --- a/src/LogEntries.php +++ b/src/LogEntries.php @@ -9,13 +9,13 @@ class LogEntries extends AbstractLogger { /** LogEntries server address for receiving logs */ - const LE_ADDRESS = 'tcp://api.logentries.com'; + const LE_ADDRESS = 'tcp://'; /** LogEntries server address for receiving logs via TLS */ - const LE_TLS_ADDRESS = 'tls://api.logentries.com'; + const LE_TLS_ADDRESS = 'ssl://'; /** LogEntries server port for receiving logs by token */ const LE_PORT = 10000; /** LogEntries server port for receiving logs with TLS by token */ - const LE_TLS_PORT = 20000; + const LE_TLS_PORT = 443; /** @var LogEntries */ private static $_instance; @@ -25,6 +25,12 @@ class LogEntries extends AbstractLogger * @var \SplStack * @link http://php.net/manual/class.splstack.php */ + + /** + * @var string + */ + private $le_address; + private $_writer_stack; /** @var resource */ private $_socketResource; @@ -217,12 +223,12 @@ public function isDataHub() public function getAddress() { if ($this->isTLS() && !$this->isDataHub()) { - return self::LE_TLS_ADDRESS; + return self::LE_TLS_ADDRESS.$this->le_address; } if ($this->isDataHub()) { return $this->_dataHubIPAddress; } - return self::LE_ADDRESS; + return self::LE_ADDRESS.$this->le_address; } /** @@ -342,7 +348,9 @@ private function isJSON($string) */ public function log($level, $message, array $context = array()) { - $this->connectIfNotConnected(); + if ($this->connectIfNotConnected()===false) { + return null; + } if (is_array($message)) { $message = json_encode($message); @@ -498,4 +506,18 @@ public function debug($message, array $context = array()) return $this->log(LogLevel::DEBUG, $message, $context); } -} \ No newline at end of file + /** + * @param string $le_address + */ + public function setLeAddress($le_address) { + $this->le_address = $le_address; + } + + /** + * @param string $token + */ + public function setToken($token) { + $this->_token = $token; + } + +}