Logging updates, some function optimisation

This commit is contained in:
Deon George
2021-08-16 00:41:43 +10:00
parent b8478adecb
commit 111461e515
6 changed files with 175 additions and 167 deletions

View File

@@ -5,6 +5,8 @@ namespace App\Classes\Sock;
use Illuminate\Support\Facades\Log;
final class SocketServer {
private const LOGKEY = 'SS-';
private $server; // Our server resource
private string $bind; // The IP address to bind to
private int $port; // The Port to bind to
@@ -79,12 +81,12 @@ final class SocketServer {
if (socket_listen($this->server,$this->backlog) === FALSE)
throw new SocketException(SocketException::CANT_LISTEN,socket_strerror(socket_last_error($this->server)));
Log::info(sprintf('Listening on [%s:%d]',$this->bind,$this->port),['m'=>__METHOD__]);
Log::info(sprintf('%s:- Listening on [%s:%d]',self::LOGKEY,$this->bind,$this->port));
$this->loop();
socket_close($this->server);
Log::info(sprintf('Closed [%s:%d]',$this->bind,$this->port),['m'=>__METHOD__]);
Log::info(sprintf('%s:= Closed [%s:%d]',self::LOGKEY,$this->bind,$this->port));
}
/**