Register file log handler by default

Add wc_register_file_log_handler function.
Calls add_filter with register function to include handler by default
This commit is contained in:
Jon Surrell 2016-11-12 19:42:32 +01:00
parent d9dcabf8f2
commit a2cce14711
1 changed files with 18 additions and 0 deletions

View File

@ -1423,6 +1423,24 @@ function wc_get_logger() {
return new $class;
}
/**
* Registers the included file log handler.
*
* @since 2.8
* @param array $handlers
* @return array
*/
function wc_register_file_log_handler( $handlers ) {
if ( ! class_exists( 'WC_Log_Handler_File' ) ) {
include_once( dirname( __FILE__ ) . '/log-handlers/class-wc-log-handler-file.php' );
}
array_push( $handlers, new WC_Log_Handler_File() );
return $handlers;
}
add_filter( 'woocommerce_register_log_handlers', 'wc_register_file_log_handler', 0 );
/**
* Store user agents. Used for tracker.
* @since 2.7.0