This commit is contained in:
dongwei 2019-01-10 14:24:47 +08:00
parent 42c37e780d
commit 2fe16ea344
2 changed files with 2 additions and 3 deletions

View File

@ -90,11 +90,10 @@ class Client
try { try {
$body = \GuzzleHttp\json_decode($resp->getBody(), true); $body = \GuzzleHttp\json_decode($resp->getBody(), true);
if (isset($body['error']) && isset($body['error']['code']) && isset($body['error']['message'])) { if (isset($body['error']) && isset($body['error']['code']) && isset($body['error']['message'])) {
throw new RpcServerException($body['error']['message'], $body['error']['code']); throw new RpcServerException($body['error']['message'], $body['error']['code']);
} }
$this->logger->info('this is a test call log'); $this->logger->info('MONITOR',compact("payload", "body"));
return $body['result']; return $body['result'];
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {

View File

@ -20,7 +20,7 @@ class ClientServiceProvider extends ServiceProvider
$config = config('rpc.client'); $config = config('rpc.client');
$logger = new Logger('rpc-client-logger'); $logger = new Logger('rpc-client-logger');
$logger->pushHandler(new StreamHandler($this->app->storagePath()."/logs/rpc_client_".date("Ymd").".log")); $logger->pushHandler(new StreamHandler($this->app->storagePath()."/logs/rpc_monitor_".date("Ymd").".log"));
$this->app->singleton('rpc', function () use ($config, $logger) { $this->app->singleton('rpc', function () use ($config, $logger) {
return new Client($config, $logger); return new Client($config, $logger);
}); });