Move trace to context. Change arguments position
This commit is contained in:
parent
a9460ef4a8
commit
390dad0dc4
14 changed files with 95 additions and 118 deletions
|
@ -70,14 +70,14 @@ if (!class_exists('WC_Retailcrm_Proxy')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
$method,
|
||||
empty($arguments) ? '[no params]' : '[with arguments]',
|
||||
WC_Retailcrm_Logger::TYPE['req'],
|
||||
['arguments' => $arguments]
|
||||
['arguments' => $arguments],
|
||||
WC_Retailcrm_Logger::TYPE['req']
|
||||
);
|
||||
/** @var \WC_Retailcrm_Response $response */
|
||||
$response = call_user_func_array(array($this->retailcrm, $method), $arguments);
|
||||
|
||||
if (is_string($response)) {
|
||||
WC_Retailcrm_Logger::info($method, $response, WC_Retailcrm_Logger::TYPE['res']);
|
||||
WC_Retailcrm_Logger::info($method, $response, [], WC_Retailcrm_Logger::TYPE['res']);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ if (!class_exists('WC_Retailcrm_Proxy')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
$method,
|
||||
sprintf("[%s] null (no response whatsoever)", $called),
|
||||
[],
|
||||
WC_Retailcrm_Logger::TYPE['res']
|
||||
);
|
||||
|
||||
|
@ -100,24 +101,27 @@ if (!class_exists('WC_Retailcrm_Proxy')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
$method,
|
||||
'Ok',
|
||||
WC_Retailcrm_Logger::TYPE['res'],
|
||||
['body' => 'request was successful, but response is omitted']
|
||||
['body' => 'request was successful, but response is omitted'],
|
||||
WC_Retailcrm_Logger::TYPE['res']
|
||||
);
|
||||
} else {
|
||||
WC_Retailcrm_Logger::info(
|
||||
$method,
|
||||
'Ok',
|
||||
WC_Retailcrm_Logger::TYPE['res'],
|
||||
['body' => json_decode($response->getRawResponse(), true)]
|
||||
['body' => json_decode($response->getRawResponse(), true)],
|
||||
WC_Retailcrm_Logger::TYPE['res']
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
WC_Retailcrm_Logger::error($method, sprintf(
|
||||
"Error: [HTTP-code %s] %s %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorString(),
|
||||
$response->getRawResponse()),
|
||||
WC_Retailcrm_Logger::error(
|
||||
$method,
|
||||
sprintf(
|
||||
"Error: [HTTP-code %s] %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorString()
|
||||
),
|
||||
['response' => $response->getRawResponse()],
|
||||
WC_Retailcrm_Logger::TYPE['res']
|
||||
);
|
||||
}
|
||||
|
@ -125,36 +129,36 @@ if (!class_exists('WC_Retailcrm_Proxy')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
$method,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
} catch (WC_Retailcrm_Exception_Json $exception) {
|
||||
WC_Retailcrm_Logger::error(
|
||||
$method,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
} catch (InvalidArgumentException $exception) {
|
||||
WC_Retailcrm_Logger::error(
|
||||
$method,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
|
|
@ -198,7 +198,6 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Module settings',
|
||||
null,
|
||||
['settings' => $settings]
|
||||
);
|
||||
$isLoyaltyUploadPrice = false;
|
||||
|
@ -601,12 +600,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -660,15 +659,15 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
}
|
||||
}
|
||||
} catch (Throwable $exception) {
|
||||
WC_Retailcrm_Logger::info(
|
||||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -893,12 +892,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -914,12 +913,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -935,12 +934,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -958,12 +957,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -981,12 +980,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
|
|
@ -83,12 +83,12 @@ if (!class_exists('WC_Retailcrm_Carts')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Error process cart: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Error process cart: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ if (!class_exists('WC_Retailcrm_Carts')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Error clear cart: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Error clear cart: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
WC_Retailcrm_Logger::TYPE['exc'])
|
||||
;
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
||||
return $isSuccessful;
|
||||
|
|
|
@ -184,7 +184,6 @@ if (!class_exists('WC_Retailcrm_Customers')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Process WC_Customer ' . $customer->get_id(),
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
$this->processCustomer($customer, $order);
|
||||
|
@ -218,7 +217,6 @@ if (!class_exists('WC_Retailcrm_Customers')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Update WC_Customer ' . $customer->get_id(),
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
$this->processCustomer($customer);
|
||||
|
@ -249,7 +247,6 @@ if (!class_exists('WC_Retailcrm_Customers')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Update WC_Customer by CRM_Customer ID: ' . $crmCustomerId,
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
$this->processCustomer($customer);
|
||||
|
@ -398,7 +395,6 @@ if (!class_exists('WC_Retailcrm_Customers')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Processing for upload WC_Customer ' . $customer->get_id(),
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
$this->processCustomer($customer);
|
||||
|
@ -711,7 +707,6 @@ if (!class_exists('WC_Retailcrm_Customers')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Build new customer from order data',
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($new_customer)]
|
||||
);
|
||||
|
||||
|
|
|
@ -86,12 +86,12 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -130,7 +130,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Assembled customers history',
|
||||
null,
|
||||
['customers_history' => $customers]
|
||||
);
|
||||
WC_Retailcrm_Plugin::$history_run = true;
|
||||
|
@ -187,7 +186,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Updated WC_Customer ' . $crmCustomer['externalId'],
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($wcCustomer)]
|
||||
);
|
||||
|
||||
|
@ -196,12 +194,12 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
}
|
||||
|
@ -251,7 +249,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Assembled orders history',
|
||||
null,
|
||||
['orders_history' => $historyAssembly]
|
||||
);
|
||||
WC_Retailcrm_Plugin::$history_run = true;
|
||||
|
@ -318,7 +315,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Result WC_Order ' . $wcOrder->get_id(),
|
||||
null,
|
||||
['wc_order' => WC_Retailcrm_Logger::formatWCObject($wcOrder)]
|
||||
);
|
||||
}
|
||||
|
@ -326,12 +322,12 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'%s - Exception in file %s on line %s Trace: %s',
|
||||
'%s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -438,7 +434,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Updating WC_Order ' . $wcOrder->get_id(),
|
||||
null,
|
||||
['wc_order' => WC_Retailcrm_Logger::formatWCObject($wcOrder)]
|
||||
);
|
||||
|
||||
|
@ -523,7 +518,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
'Crm Product not found by ' . $this->bindField,
|
||||
null,
|
||||
['crm_product' => $crmProduct['offer']]
|
||||
);
|
||||
|
||||
|
@ -692,7 +686,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Creating WC_Order from CRM_Order: ' . $order['id'] ?? 'id empty',
|
||||
null,
|
||||
['crm_order' => $order]
|
||||
);
|
||||
|
||||
|
@ -884,7 +877,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
'Crm_Product not found by ' . $this->bindField,
|
||||
null,
|
||||
['crm_product' => $crmProduct['offer']]
|
||||
);
|
||||
|
||||
|
@ -1182,7 +1174,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
$wcProduct->get_id(),
|
||||
$crmProduct['id'] ?? 'id empty'
|
||||
),
|
||||
null,
|
||||
[
|
||||
'wc_order' => WC_Retailcrm_Logger::formatWCObject($wcOrder),
|
||||
'wc_product' => WC_Retailcrm_Logger::formatWCObject($wcProduct),
|
||||
|
@ -1243,7 +1234,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Updating order product WC_Order_Item, CRM_Product',
|
||||
null,
|
||||
[
|
||||
'wc_order_item' => WC_Retailcrm_Logger::formatWCObject($wcOrderItem),
|
||||
'crm_product' => $crmProduct,
|
||||
|
@ -1288,7 +1278,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Processing CRM_Order ' . $order['id'] ?? 'id empty',
|
||||
null,
|
||||
['crm_order' => $order]
|
||||
);
|
||||
|
||||
|
@ -1299,7 +1288,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Cannot get order data from retailCRM. Skipping customer change.',
|
||||
null,
|
||||
['history_data' => $order]
|
||||
);
|
||||
|
||||
|
@ -1334,7 +1322,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Cannot get order data from retailCRM. Skipping customer change.',
|
||||
null,
|
||||
['history_data' => $order]
|
||||
);
|
||||
|
||||
|
@ -1372,7 +1359,7 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
} catch (\Exception $exception) {
|
||||
$errorMessage = sprintf(
|
||||
'Error switching order externalId=%s to customer id=%s (new company: id=%s %s). Reason: %s' .
|
||||
' - Exception in file %s on line %s. Trace: %s'
|
||||
' - Exception in file %s on line %s'
|
||||
,
|
||||
$order['externalId'],
|
||||
$newCustomerId,
|
||||
|
@ -1380,11 +1367,15 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
isset($order['company']) ? $order['company']['name'] : '',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
);
|
||||
|
||||
WC_Retailcrm_Logger::error(__METHOD__, $errorMessage, WC_Retailcrm_Logger::TYPE['exc']);
|
||||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
$errorMessage,
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
$handled = false;
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@ -1493,7 +1484,6 @@ if (!class_exists('WC_Retailcrm_History')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Using this individual person data in order to set it into order ' . $data->getWcOrder()->get_id(),
|
||||
null,
|
||||
['crm_customer' => $crmCustomer]
|
||||
);
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Exception get loyalty accounts: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Exception get loyalty accounts: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -104,12 +104,12 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Exception while registering in the loyalty program: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Exception while registering in the loyalty program: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -134,12 +134,12 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Exception while activate loyalty account: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Exception while activate loyalty account: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -380,12 +380,12 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Exception get loyalty accounts: %s - Exception in file %s on line %s Trace: %s',
|
||||
'Exception get loyalty accounts: %s - Exception in file %s on line %s',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Start order creating ' . is_int($orderId) ? $orderId : '',
|
||||
null,
|
||||
['wc_order' => WC_Retailcrm_Logger::formatWCObject($orderId)]
|
||||
);
|
||||
|
||||
|
@ -136,7 +135,6 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Create WC_Order ' . $wcOrder->get_id(),
|
||||
null,
|
||||
['wc_order' => WC_Retailcrm_Logger::formatWCObject($wcOrder)]
|
||||
);
|
||||
$this->processOrder($wcOrder);
|
||||
|
@ -161,12 +159,12 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Error message: %s - Exception in file: %s on line: %s. Trace: %s',
|
||||
'Error message: %s - Exception in file: %s on line: %s.',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -345,7 +343,6 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Update WC_Order ' . $wcOrder->get_id(),
|
||||
null,
|
||||
['wc_order' => WC_Retailcrm_Logger::formatWCObject($wcOrder)]
|
||||
);
|
||||
$needRecalculate = false;
|
||||
|
@ -386,12 +383,12 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
sprintf(
|
||||
'Error message: %s - Exception in file: %s on line: %s. Trace: %s',
|
||||
'Error message: %s - Exception in file: %s on line: %s.',
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$exception->getTraceAsString()
|
||||
$exception->getLine()
|
||||
),
|
||||
['trace' => $exception->getTraceAsString()],
|
||||
WC_Retailcrm_Logger::TYPE['exc']
|
||||
);
|
||||
|
||||
|
@ -554,7 +551,6 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Process WC_Order_Item_Product ' . $id,
|
||||
null,
|
||||
['wc_order_item_product' => WC_Retailcrm_Logger::formatWCObject($item)]
|
||||
);
|
||||
$crmItem = $crmItems[$id] ?? null;
|
||||
|
|
|
@ -46,7 +46,6 @@ class WC_Retailcrm_Customer_Switcher implements WC_Retailcrm_Builder_Interface
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Build Customer state',
|
||||
null,
|
||||
['customer_state' => $this->data]
|
||||
);
|
||||
|
||||
|
@ -108,7 +107,6 @@ class WC_Retailcrm_Customer_Switcher implements WC_Retailcrm_Builder_Interface
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Switching customer in order ' . $wcOrder->get_id(),
|
||||
null,
|
||||
['crm_customer' => $newCustomer]
|
||||
);
|
||||
|
||||
|
|
|
@ -121,9 +121,9 @@ if (!class_exists('WC_Retailcrm_Logger') && class_exists('WC_Log_Levels')) :
|
|||
* @param null|string $type
|
||||
* @param array $context
|
||||
*/
|
||||
public static function error(string $method, string $message, $type = null, array $context = [])
|
||||
public static function error(string $method, string $message, array $context = [], $type = null)
|
||||
{
|
||||
self::log($method, $message, $type, $context, WC_Log_Levels::ERROR);
|
||||
self::log($method, $message, $context, $type, WC_Log_Levels::ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,9 +134,9 @@ if (!class_exists('WC_Retailcrm_Logger') && class_exists('WC_Log_Levels')) :
|
|||
* @param null|string $type
|
||||
* @param array $context
|
||||
*/
|
||||
public static function info(string $method, string $message, $type = null, array $context = [])
|
||||
public static function info(string $method, string $message, array $context = [], $type = null)
|
||||
{
|
||||
self::log($method, $message, $type, $context, WC_Log_Levels::INFO);
|
||||
self::log($method, $message, $context, $type, WC_Log_Levels::INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ if (!class_exists('WC_Retailcrm_Logger') && class_exists('WC_Log_Levels')) :
|
|||
* @param array $context
|
||||
* @param string|null $level
|
||||
*/
|
||||
private static function log(string $method, string $message, $type = null, array $context = [], $level = 'info')
|
||||
private static function log(string $method, string $message, array $context = [], $type = null, $level = 'info')
|
||||
{
|
||||
$time = self::getStartTime();
|
||||
$context['time'] = round((microtime(true) - $time), 3);
|
||||
|
|
|
@ -36,7 +36,6 @@ class WC_Retailcrm_Customer_Address extends WC_Retailcrm_Abstracts_Address
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
'Error: Customer address is empty',
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ class WC_Retailcrm_Customer_Corporate_Address extends WC_Retailcrm_Abstracts_Add
|
|||
WC_Retailcrm_Logger::error(
|
||||
__METHOD__,
|
||||
'Error: Corporate Customer address is empty.',
|
||||
null,
|
||||
['wc_customer' => WC_Retailcrm_Logger::formatWCObject($customer)]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,6 @@ class WC_Retailcrm_WC_Customer_Builder extends WC_Retailcrm_Abstract_Builder
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Building WC_Customer from data',
|
||||
null,
|
||||
['customer_data' => $this->data]
|
||||
);
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ class WC_Retailcrm_Customer_Switcher_Result
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'Saving WC_Customer and WC_Order',
|
||||
null,
|
||||
[
|
||||
'wc_customer' => WC_Retailcrm_Logger::formatWCObject($this->wcCustomer),
|
||||
'wc_order' => WC_Retailcrm_Logger::formatWCObject($this->wcOrder),
|
||||
|
|
|
@ -173,7 +173,6 @@ class WC_Retailcrm_Customer_Switcher_State
|
|||
WC_Retailcrm_Logger::info(
|
||||
__METHOD__,
|
||||
'State data - customer and contact',
|
||||
null,
|
||||
[
|
||||
'customer' => $this->getNewCustomer(),
|
||||
'contact' => $this->getNewContact(),
|
||||
|
|
Loading…
Add table
Reference in a new issue