diff --git a/examples/client.php b/examples/client.php index 56e90fa..4dbaf90 100644 --- a/examples/client.php +++ b/examples/client.php @@ -1,7 +1,6 @@ - +?> \ No newline at end of file diff --git a/src/BaseService.php b/src/BaseService.php index abdaee2..7809736 100644 --- a/src/BaseService.php +++ b/src/BaseService.php @@ -76,6 +76,11 @@ abstract class BaseService { * @var array swoole配置数组 */ public $config; + + /** + * @var string 日志路径 + */ + public $logFile = "/tmp/airpc-log"; /** * @param string $listen 监听地址 @@ -89,7 +94,8 @@ abstract class BaseService { 'task_worker_num' => $this->taskWorkerNum, 'max_request' => $this->maxRequest, 'max_conn' => $this->maxConn, - 'daemonize' => $this->daemonize + 'daemonize' => $this->daemonize, + 'log_file' => $this->logFile ]; } diff --git a/src/Pack.php b/src/Pack.php index bd67136..10957cc 100644 --- a/src/Pack.php +++ b/src/Pack.php @@ -12,14 +12,6 @@ namespace blobt\airpc; * * @author blobt * Rpc协议 0.3 - * struct - * { - * unisgned char type; - * unsigned int time; - * unisgned int serid; - * unsigned int length; - * char body[0]; - * } */ class Pack { diff --git a/src/RpcServer.php b/src/RpcServer.php index 0a846f2..837e667 100644 --- a/src/RpcServer.php +++ b/src/RpcServer.php @@ -63,11 +63,11 @@ class RpcServer extends BaseService { $this->send($fd, $ret); } catch (\Error $e) { //TODO 记录日志 - print_r($e); + echo "YeeError: ".$e->getMessage(); $this->send($fd, "YeeError"); } catch (\Exception $e) { //TODO 记录日志 - print_r($e); + echo "YeeException: ".$e->getMessage(); $this->send($fd, "YeeException"); } }