add date in log: system/library/retailcrm/RetailcrmProxy.php

This commit is contained in:
Dmitry Akolzin 2017-04-06 16:54:52 +03:00
parent 707a3a1783
commit eb1d80304e

View File

@ -20,22 +20,23 @@ class RetailcrmProxy
{ {
try { try {
$response = call_user_func_array(array($this->api, $method), $arguments); $response = call_user_func_array(array($this->api, $method), $arguments);
$date = date('[Y-m-d H:i:s]');
if (!$response->isSuccessful()) { if (!$response->isSuccessful()) {
error_log("[$method] " . $response->getErrorMsg() . "\n", 3, $this->log); error_log($date . " [$method] " . $response->getErrorMsg() . "\n", 3, $this->log);
if (isset($response['errors'])) { if (isset($response['errors'])) {
$error = implode("\n", $response['errors']); $error = implode("\n", $response['errors']);
error_log($error . "\n", 3, $this->log); error_log($date .' '. $error . "\n", 3, $this->log);
} }
$response = false; $response = false;
} }
return $response; return $response;
} catch (CurlException $e) { } catch (CurlException $e) {
error_log("[$method] " . $e->getMessage() . "\n", 3, $this->log); error_log($date . " [$method] " . $e->getMessage() . "\n", 3, $this->log);
return false; return false;
} catch (InvalidJsonException $e) { } catch (InvalidJsonException $e) {
error_log("[$method] " . $e->getMessage() . "\n", 3, $this->log); error_log($date . " [$method] " . $e->getMessage() . "\n", 3, $this->log);
return false; return false;
} }
} }