mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Hide PayPal Insights when WP Debug is set to false. Also allow logging when WP Debug is set to false.
This commit is contained in:
parent
b4e35e2959
commit
8f99aa5f9e
2 changed files with 11 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
export function log(message, level = 'info') {
|
||||
const wpDebug = window.wc_ppcp_axo?.wp_debug;
|
||||
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
|
||||
if(!wpDebug || !endpoint) {
|
||||
if (!endpoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,14 @@ export function log(message, level = 'info') {
|
|||
}
|
||||
})
|
||||
}).then(() => {
|
||||
switch (level) {
|
||||
case 'error':
|
||||
console.error(`[AXO] ${message}`);
|
||||
break;
|
||||
default:
|
||||
console.log(`[AXO] ${message}`);
|
||||
if (wpDebug) {
|
||||
switch (level) {
|
||||
case 'error':
|
||||
console.error(`[AXO] ${message}`);
|
||||
break;
|
||||
default:
|
||||
console.log(`[AXO] ${message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue