Add log threshold setting to settings page

This commit is contained in:
Jon Surrell 2016-12-11 13:01:12 +01:00
parent ffd0d380ee
commit be38e8f2fe
2 changed files with 34 additions and 15 deletions

View File

@ -136,7 +136,7 @@ class WC_Settings_General extends WC_Settings_Page {
array(
'title' => __( 'Default log handler', 'woocommerce' ),
'id' => 'woocommerce_default_log_handler',
'default' => 'geolocation',
'default' => 'file',
'type' => 'select',
'class' => 'wc-enhanced-select',
'options' => array(
@ -145,6 +145,25 @@ class WC_Settings_General extends WC_Settings_Page {
),
),
array(
'title' => __( 'Log level threshold', 'woocommerce' ),
'id' => 'woocommerce_log_threshold',
'desc_tip' => __( 'This setting defines the minimum level that will be handled by the logger. Anything belew this level will be ignored. Recommended setting for live sites: notice', 'woocommerce' ),
'default' => 'notice',
'type' => 'select',
'class' => 'wc-enhanced-select',
'options' => array(
WC_Log_Levels::EMERGENCY => 'Emergency: system is unusable',
WC_Log_Levels::ALERT => 'Alert: action must be taken immediately',
WC_Log_Levels::CRITICAL => 'Critical: critical conditions',
WC_Log_Levels::ERROR => 'Error: error conditions',
WC_Log_Levels::WARNING => 'Warning: warning conditions',
WC_Log_Levels::NOTICE => 'Notice: normal but significant condition',
WC_Log_Levels::INFO => 'Informational: informational messages',
WC_Log_Levels::DEBUG => 'Debug: debug-level messages',
),
),
array(
'title' => __( 'Enable taxes', 'woocommerce' ),
'desc' => __( 'Enable taxes and tax calculations', 'woocommerce' ),

View File

@ -30,14 +30,14 @@ abstract class WC_Log_Levels {
*
* @see @link {https://tools.ietf.org/html/rfc5424}
*/
const DEBUG = 'debug';
const INFO = 'info';
const NOTICE = 'notice';
const WARNING = 'warning';
const ERROR = 'error';
const CRITICAL = 'critical';
const ALERT = 'alert';
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
/**
* Level strings mapped to integer severity.
@ -46,14 +46,14 @@ abstract class WC_Log_Levels {
* @access protected
*/
protected static $level_severity = array(
self::DEBUG => 100,
self::INFO => 200,
self::NOTICE => 300,
self::WARNING => 400,
self::ERROR => 500,
self::CRITICAL => 600,
self::ALERT => 700,
self::EMERGENCY => 800,
self::ALERT => 700,
self::CRITICAL => 600,
self::ERROR => 500,
self::WARNING => 400,
self::NOTICE => 300,
self::INFO => 200,
self::DEBUG => 100,
);
/**