日志
This commit is contained in:
parent
42c37e780d
commit
2fe16ea344
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user