Add WC_Log_Handler_Interface

Abstract class `WC_Log_Handler` implements interface
This commit is contained in:
Jon Surrell 2017-01-24 14:10:00 +01:00
parent eb2b9d78f8
commit 8e0f40d3d1
3 changed files with 29 additions and 14 deletions

View File

@ -11,20 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* @category Abstract Class
* @author WooThemes
*/
abstract class WC_Log_Handler {
/**
* Handle a log entry.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug
* @param string $message Log message.
* @param array $context Additional information for log handlers.
*
* @return bool False if value was not handled and true if value was handled.
*/
abstract public function handle( $timestamp, $level, $message, $context );
abstract class WC_Log_Handler implements WC_Log_Handler_Interface {
/**
* Formats a timestamp for use in log messages.

View File

@ -0,0 +1,27 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* WC Log Handler Interface
*
* Functions that must be defined to correctly fulfill log handler API.
*
* @version 1.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Log_Handler_Interface {
/**
* Handle a log entry.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug
* @param string $message Log message.
* @param array $context Additional information for log handlers.
*
* @return bool False if value was not handled and true if value was handled.
*/
public function handle( $timestamp, $level, $message, $context );
}

View File

@ -294,6 +294,7 @@ final class WooCommerce {
include_once( WC_ABSPATH . 'includes/interfaces/class-wc-product-variable-data-store-interface.php' );
include_once( WC_ABSPATH . 'includes/interfaces/class-wc-shipping-zone-data-store-interface.php' );
include_once( WC_ABSPATH . 'includes/interfaces/class-wc-logger-interface.php' );
include_once( WC_ABSPATH . 'includes/interfaces/class-wc-log-handler-interface.php' );
include_once( WC_ABSPATH . 'includes/abstracts/abstract-wc-payment-token.php' ); // Payment Tokens
include_once( WC_ABSPATH . 'includes/abstracts/abstract-wc-product.php' ); // Products
include_once( WC_ABSPATH . 'includes/abstracts/abstract-wc-order.php' ); // Orders