-
Notifications
You must be signed in to change notification settings - Fork 69
/
debug-mode.js
42 lines (38 loc) · 990 Bytes
/
debug-mode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* External dependencies
*/
import { CheckboxControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { useDebugLog, useDevMode } from 'wcpay/data';
const DebugMode = () => {
const isDevModeEnabled = useDevMode();
const [ isLoggingChecked, setIsLoggingChecked ] = useDebugLog();
return (
<>
<h4 tabIndex="-1">
{ __( 'Debug mode', 'woocommerce-payments' ) }
</h4>
<CheckboxControl
label={
isDevModeEnabled
? __(
'Sandbox mode is active so logging is on by default.',
'woocommerce-payments'
)
: __( 'Log error messages', 'woocommerce-payments' )
}
help={ __(
'When enabled, payment error logs will be saved to WooCommerce > Status > Logs.',
'woocommerce-payments'
) }
disabled={ isDevModeEnabled }
checked={ isDevModeEnabled || isLoggingChecked }
onChange={ setIsLoggingChecked }
/>
</>
);
};
export default DebugMode;