class-wc-abstract-order-data-store-interface.php
8 years ago
class-wc-coupon-data-store-interface.php
8 years ago
class-wc-customer-data-store-interface.php
8 years ago
class-wc-customer-download-data-store-interface.php
8 years ago
class-wc-customer-download-log-data-store-interface.php
8 years ago
class-wc-importer-interface.php
8 years ago
class-wc-log-handler-interface.php
8 years ago
class-wc-logger-interface.php
8 years ago
class-wc-object-data-store-interface.php
8 years ago
class-wc-order-data-store-interface.php
6 years ago
class-wc-order-item-data-store-interface.php
8 years ago
class-wc-order-item-product-data-store-interface.php
8 years ago
class-wc-order-item-type-data-store-interface.php
8 years ago
class-wc-order-refund-data-store-interface.php
8 years ago
class-wc-payment-token-data-store-interface.php
8 years ago
class-wc-product-data-store-interface.php
8 years ago
class-wc-product-variable-data-store-interface.php
8 years ago
class-wc-queue-interface.php
7 years ago
class-wc-shipping-zone-data-store-interface.php
8 years ago
class-wc-webhooks-data-store-interface.php
7 years ago
class-wc-logger-interface.php
140 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Logger Interface |
| 4 | * |
| 5 | * @version 3.0.0 |
| 6 | * @package WooCommerce/Interface |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * WC Logger Interface |
| 15 | * |
| 16 | * Functions that must be defined to correctly fulfill logger API. |
| 17 | * |
| 18 | * @version 3.0.0 |
| 19 | */ |
| 20 | interface WC_Logger_Interface { |
| 21 | |
| 22 | /** |
| 23 | * Add a log entry. |
| 24 | * |
| 25 | * This is not the preferred method for adding log messages. Please use log() or any one of |
| 26 | * the level methods (debug(), info(), etc.). This method may be deprecated in the future. |
| 27 | * |
| 28 | * @param string $handle File handle. |
| 29 | * @param string $message Log message. |
| 30 | * @param string $level Log level. |
| 31 | * |
| 32 | * @return bool True if log was added, otherwise false. |
| 33 | */ |
| 34 | public function add( $handle, $message, $level = WC_Log_Levels::NOTICE ); |
| 35 | |
| 36 | /** |
| 37 | * Add a log entry. |
| 38 | * |
| 39 | * @param string $level One of the following: |
| 40 | * 'emergency': System is unusable. |
| 41 | * 'alert': Action must be taken immediately. |
| 42 | * 'critical': Critical conditions. |
| 43 | * 'error': Error conditions. |
| 44 | * 'warning': Warning conditions. |
| 45 | * 'notice': Normal but significant condition. |
| 46 | * 'info': Informational messages. |
| 47 | * 'debug': Debug-level messages. |
| 48 | * @param string $message Log message. |
| 49 | * @param array $context Optional. Additional information for log handlers. |
| 50 | */ |
| 51 | public function log( $level, $message, $context = array() ); |
| 52 | |
| 53 | /** |
| 54 | * Adds an emergency level message. |
| 55 | * |
| 56 | * System is unusable. |
| 57 | * |
| 58 | * @param string $message Log message. |
| 59 | * @param array $context Optional. Additional information for log handlers. |
| 60 | */ |
| 61 | public function emergency( $message, $context = array() ); |
| 62 | |
| 63 | /** |
| 64 | * Adds an alert level message. |
| 65 | * |
| 66 | * Action must be taken immediately. |
| 67 | * Example: Entire website down, database unavailable, etc. |
| 68 | * |
| 69 | * @param string $message Log message. |
| 70 | * @param array $context Optional. Additional information for log handlers. |
| 71 | */ |
| 72 | public function alert( $message, $context = array() ); |
| 73 | |
| 74 | /** |
| 75 | * Adds a critical level message. |
| 76 | * |
| 77 | * Critical conditions. |
| 78 | * Example: Application component unavailable, unexpected exception. |
| 79 | * |
| 80 | * @param string $message Log message. |
| 81 | * @param array $context Optional. Additional information for log handlers. |
| 82 | */ |
| 83 | public function critical( $message, $context = array() ); |
| 84 | |
| 85 | /** |
| 86 | * Adds an error level message. |
| 87 | * |
| 88 | * Runtime errors that do not require immediate action but should typically be logged |
| 89 | * and monitored. |
| 90 | * |
| 91 | * @param string $message Log message. |
| 92 | * @param array $context Optional. Additional information for log handlers. |
| 93 | */ |
| 94 | public function error( $message, $context = array() ); |
| 95 | |
| 96 | /** |
| 97 | * Adds a warning level message. |
| 98 | * |
| 99 | * Exceptional occurrences that are not errors. |
| 100 | * |
| 101 | * Example: Use of deprecated APIs, poor use of an API, undesirable things that are not |
| 102 | * necessarily wrong. |
| 103 | * |
| 104 | * @param string $message Log message. |
| 105 | * @param array $context Optional. Additional information for log handlers. |
| 106 | */ |
| 107 | public function warning( $message, $context = array() ); |
| 108 | |
| 109 | /** |
| 110 | * Adds a notice level message. |
| 111 | * |
| 112 | * Normal but significant events. |
| 113 | * |
| 114 | * @param string $message Log message. |
| 115 | * @param array $context Optional. Additional information for log handlers. |
| 116 | */ |
| 117 | public function notice( $message, $context = array() ); |
| 118 | |
| 119 | /** |
| 120 | * Adds a info level message. |
| 121 | * |
| 122 | * Interesting events. |
| 123 | * Example: User logs in, SQL logs. |
| 124 | * |
| 125 | * @param string $message Log message. |
| 126 | * @param array $context Optional. Additional information for log handlers. |
| 127 | */ |
| 128 | public function info( $message, $context = array() ); |
| 129 | |
| 130 | /** |
| 131 | * Adds a debug level message. |
| 132 | * |
| 133 | * Detailed debug information. |
| 134 | * |
| 135 | * @param string $message Log message. |
| 136 | * @param array $context Optional. Additional information for log handlers. |
| 137 | */ |
| 138 | public function debug( $message, $context = array() ); |
| 139 | } |
| 140 |