/** * Sends a Message to the remote Log Server. * * @param Message An instance of SyslogMessage class. * @param LogServer The Server to which the message will be sent. If omitted, * the one specified when the class was instantiated will be used instead. It * can be indicated as <server>[:<port>]. * @param Timeout Timeout for the UDP Connection, in seconds. If omitted, * the one specified when the class was instantiated will be used instead. * @return True if the message was sent correctly. If not, an array containing * an Error Code and an Error Message. */ function Send(SyslogMessage $Message, $LogServer = null, $Timeout = null) { $this->SetLogServer($LogServer); $this->SetTimeout($Timeout); $Socket = fsockopen(sprintf('udp://%s', $this->LogServer), $this->Port, $ErrorNumber, $ErrorMessage); if ($Socket) { foreach ($Message->GetMessageChunks() as $MessageChunk) { fwrite($Socket, $MessageChunk); } fclose($Socket); return true; } else { return array($ErrorNumber, $ErrorMessage); } }
public function __construct($Message, $Facility = 16, $Severity = 5, $Timestamp, $Options = null) { parent::__construct($Message, $Facility, $Severity, $Timestamp, $Options); }