Skip to content

Commit

Permalink
fixed logger and server
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed May 2, 2017
1 parent 67be5e6 commit 40e8f15
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Logger/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function convertStatusCodeToLevel($levelCode)
*/
public function addRecord($level, $message, array $context = array())
{
if (!$this->handlers) {
if (empty($this->handlers)) {
$this->pushHandler(new StreamHandler('php://temp'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Servitization/Server/HTTPServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function onRequest(swoole_http_request $swooleRequet, swoole_http_respons
$swooleResponse->cookie($key, $cookieParam);
}
} catch (Exception $e) {
$response = app()->handleException($request, $e);
$response = app()->handleException($e);
}

$swooleResponse->status($response->getStatusCode());
Expand Down
2 changes: 1 addition & 1 deletion src/Servitization/Server/TCPServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function doWork(swoole_server $server, $fd, $data, $from_id)
try {
$response = app()->handleRequest($request);
} catch (\Exception $e) {
$response = app()->handleException($request, $e);
$response = app()->handleException($e);
}
$server->send($fd, (string) $response->getBody());
app()->shutdown($request, $response);
Expand Down
2 changes: 1 addition & 1 deletion src/Servitization/Server/UDPServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function doPacket(swoole_server $server, $data, $clientInfo)
try {
$response = app()->handleRequest($request);
} catch (\Exception $e) {
$response = app()->handleException($request, $e);
$response = app()->handleException($e);
}
$server->sendto($clientInfo['address'], $clientInfo['port'], (string) $response->getBody());
app()->shutdown($request, $response);
Expand Down
2 changes: 1 addition & 1 deletion src/Servitization/Server/WebSocketServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function doMessage(swoole_server $server, swoole_websocket_frame $frame)
try {
$response = app()->handleRequest($request);
} catch (\Exception $e) {
$response = app()->handleException($request, $e);
$response = app()->handleException($e);
}
$server->push($frame->fd, (string) $response->getBody());
app()->shutdown($request, $response);
Expand Down

0 comments on commit 40e8f15

Please sign in to comment.