Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
36 changes: 29 additions & 7 deletions src/LogEntries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -498,4 +506,18 @@ public function debug($message, array $context = array())
return $this->log(LogLevel::DEBUG, $message, $context);
}

}
/**
* @param string $le_address
*/
public function setLeAddress($le_address) {
$this->le_address = $le_address;
}

/**
* @param string $token
*/
public function setToken($token) {
$this->_token = $token;
}

}