mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🚚 Move ConsoleLogger to wc-gateway module
This commit is contained in:
parent
f69209b91c
commit
3c200e408a
3 changed files with 9 additions and 6 deletions
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* Logs debug details to the console.
|
||||
*
|
||||
* A utility class that is used by payment buttons on the front-end, like the GooglePayButton.
|
||||
*/
|
||||
export default class ConsoleLogger {
|
||||
/**
|
||||
* The prefix to display before every log output.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
#prefix = '';
|
||||
|
||||
/**
|
||||
* Whether logging is enabled, disabled by default.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
#enabled = false;
|
||||
|
||||
constructor( ...prefixes ) {
|
||||
if ( prefixes.length ) {
|
||||
this.#prefix = `[${ prefixes.join( ' | ' ) }]`;
|
||||
}
|
||||
}
|
||||
|
||||
set enabled( state ) {
|
||||
this.#enabled = state;
|
||||
}
|
||||
|
||||
log( ...args ) {
|
||||
if ( this.#enabled ) {
|
||||
console.log( this.#prefix, ...args );
|
||||
}
|
||||
}
|
||||
|
||||
error( ...args ) {
|
||||
if ( this.#enabled ) {
|
||||
console.error( this.#prefix, ...args );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import ConsoleLogger from '../Helper/ConsoleLogger';
|
||||
import ConsoleLogger from '../../../../../ppcp-wc-gateway/resources/js/helper/ConsoleLogger';
|
||||
import { apmButtonsInit } from '../Helper/ApmButtons';
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue