diff --git a/includes/admin/class-wc-admin-log-table-list.php b/includes/admin/class-wc-admin-log-table-list.php index b6f10279b90..1b7e43614de 100644 --- a/includes/admin/class-wc-admin-log-table-list.php +++ b/includes/admin/class-wc-admin-log-table-list.php @@ -72,7 +72,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table { 'timestamp' => __( 'Timestamp', 'woocommerce' ), 'level' => __( 'Level', 'woocommerce' ), 'message' => __( 'Message', 'woocommerce' ), - 'tag' => __( 'Tag', 'woocommerce' ), + 'source' => __( 'Source', 'woocommerce' ), ); } @@ -133,13 +133,13 @@ class WC_Admin_Log_Table_List extends WP_List_Table { } /** - * Tag column. + * Source column. * * @param array $log * @return string */ - public function column_tag( $log ) { - return esc_html( $log['tag'] ); + public function column_source( $log ) { + return esc_html( $log['source'] ); } /** @@ -162,7 +162,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table { return array( 'timestamp' => array( 'timestamp', true ), 'level' => array( 'level', true ), - 'tag' => array( 'tag', true ), + 'source' => array( 'source', true ), ); } @@ -197,7 +197,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table { $search = ''; if ( ! empty( $_REQUEST['s'] ) ) { - $search = "AND tag LIKE '%" . esc_sql( $wpdb->esc_like( wc_clean( $_REQUEST['s'] ) ) ) . "%' "; + $search = "AND source LIKE '%" . esc_sql( $wpdb->esc_like( wc_clean( $_REQUEST['s'] ) ) ) . "%' "; } if ( ! empty( $_REQUEST['orderby'] ) ) { @@ -205,7 +205,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table { // Intentional cascade, these are valid values. case 'timestamp': - case 'tag': + case 'source': case 'level': $order_by = $_REQUEST['orderby']; break; @@ -226,7 +226,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table { } $this->items = $wpdb->get_results( - "SELECT log_id, timestamp, level, message, tag + "SELECT log_id, timestamp, level, message, source FROM {$wpdb->prefix}woocommerce_log WHERE 1 = 1 {$level_filter} {$search} ORDER BY {$order_by} {$order_order} " . diff --git a/includes/class-wc-background-updater.php b/includes/class-wc-background-updater.php index ac35a0bf743..1a408c82e75 100644 --- a/includes/class-wc-background-updater.php +++ b/includes/class-wc-background-updater.php @@ -41,7 +41,7 @@ class WC_Background_Updater extends WP_Background_Process { if ( is_wp_error( $dispatched ) ) { $logger->error( sprintf( 'Unable to dispatch WooCommerce updater: %s', $dispatched->get_error_message() ), - array( 'tag' => 'wc_db_updates' ) + array( 'source' => 'wc_db_updates' ) ); } } @@ -105,11 +105,11 @@ class WC_Background_Updater extends WP_Background_Process { include_once( dirname( __FILE__ ) . '/wc-update-functions.php' ); if ( is_callable( $callback ) ) { - $logger->info( sprintf( 'Running %s callback', $callback ), array( 'tag' => 'wc_db_updates' ) ); + $logger->info( sprintf( 'Running %s callback', $callback ), array( 'source' => 'wc_db_updates' ) ); call_user_func( $callback ); - $logger->info( sprintf( 'Finished %s callback', $callback ), array( 'tag' => 'wc_db_updates' ) ); + $logger->info( sprintf( 'Finished %s callback', $callback ), array( 'source' => 'wc_db_updates' ) ); } else { - $logger->notice( sprintf( 'Could not find %s callback', $callback ), array( 'tag' => 'wc_db_updates' ) ); + $logger->notice( sprintf( 'Could not find %s callback', $callback ), array( 'source' => 'wc_db_updates' ) ); } return false; @@ -123,7 +123,7 @@ class WC_Background_Updater extends WP_Background_Process { */ protected function complete() { $logger = wc_get_logger(); - $logger->info( 'Data update complete', array( 'tag' => 'wc_db_updates' ) ); + $logger->info( 'Data update complete', array( 'source' => 'wc_db_updates' ) ); WC_Install::update_db_version(); parent::complete(); } diff --git a/includes/class-wc-geo-ip.php b/includes/class-wc-geo-ip.php index f049b4bbc12..40baa908e2f 100644 --- a/includes/class-wc-geo-ip.php +++ b/includes/class-wc-geo-ip.php @@ -1173,7 +1173,7 @@ class WC_Geo_IP { if ( empty( self::$log ) ) { self::$log = wc_get_logger(); } - self::$log->log( $level, $message, array( 'tag' => 'geoip' ) ); + self::$log->log( $level, $message, array( 'source' => 'geoip' ) ); } /** diff --git a/includes/class-wc-geolocation.php b/includes/class-wc-geolocation.php index dde498fd97c..5063fd44adc 100644 --- a/includes/class-wc-geolocation.php +++ b/includes/class-wc-geolocation.php @@ -185,7 +185,7 @@ class WC_Geolocation { $logger = wc_get_logger(); if ( ! is_callable( 'gzopen' ) ) { - $logger->notice( 'Server does not support gzopen', array( 'tag' => 'geolocation' ) ); + $logger->notice( 'Server does not support gzopen', array( 'source' => 'geolocation' ) ); return; } @@ -208,13 +208,13 @@ class WC_Geolocation { gzclose( $gzhandle ); fclose( $handle ); } else { - $logger->notice( 'Unable to open database file', array( 'tag' => 'geolocation' ) ); + $logger->notice( 'Unable to open database file', array( 'source' => 'geolocation' ) ); } @unlink( $tmp_database_path ); } else { $logger->notice( 'Unable to download GeoIP Database: ' . $tmp_database_path->get_error_message(), - array( 'tag' => 'geolocation' ) + array( 'source' => 'geolocation' ) ); } } diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index d7bf9b11a47..ebe78be4ed5 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -247,7 +247,7 @@ class WC_Install { foreach ( $update_callbacks as $update_callback ) { $logger->info( sprintf( 'Queuing %s - %s', $version, $update_callback ), - array( 'tag' => 'wc_db_updates' ) + array( 'source' => 'wc_db_updates' ) ); self::$background_updater->push_to_queue( $update_callback ); $update_queued = true; @@ -609,7 +609,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_log ( log_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, timestamp datetime NOT NULL, level smallint(4) NOT NULL, - tag varchar(255) NOT NULL, + source varchar(255) NOT NULL, message longtext NOT NULL, context longtext NULL, PRIMARY KEY (log_id), diff --git a/includes/class-wc-logger.php b/includes/class-wc-logger.php index 4d0159ee650..85877786348 100644 --- a/includes/class-wc-logger.php +++ b/includes/class-wc-logger.php @@ -73,7 +73,7 @@ class WC_Logger { public function add( $handle, $message ) { wc_deprecated_function( 'WC_Logger::add', '2.7', 'WC_Logger::log' ); $message = apply_filters( 'woocommerce_logger_add_message', $message, $handle ); - $this->log( WC_Log_Levels::NOTICE, $message, array( 'tag' => $handle, '_legacy' => true ) ); + $this->log( WC_Log_Levels::NOTICE, $message, array( 'source' => $handle, '_legacy' => true ) ); wc_do_deprecated_action( 'woocommerce_log_add', array( $handle, $message ), '2.7', 'This action has been deprecated with no alternative.' ); return true; } diff --git a/includes/emails/class-wc-email.php b/includes/emails/class-wc-email.php index 2aa2ad743ca..1da605ad1d9 100644 --- a/includes/emails/class-wc-email.php +++ b/includes/emails/class-wc-email.php @@ -418,7 +418,7 @@ class WC_Email extends WC_Settings_API { $content = $emogrifier->emogrify(); } catch ( Exception $e ) { $logger = wc_get_logger(); - $logger->error( $e->getMessage(), array( 'tag' => 'emogrifier' ) ); + $logger->error( $e->getMessage(), array( 'source' => 'emogrifier' ) ); } } return $content; diff --git a/includes/gateways/paypal/class-wc-gateway-paypal.php b/includes/gateways/paypal/class-wc-gateway-paypal.php index 76f2b92e645..ade35aeb6c9 100644 --- a/includes/gateways/paypal/class-wc-gateway-paypal.php +++ b/includes/gateways/paypal/class-wc-gateway-paypal.php @@ -84,7 +84,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway { if ( empty( self::$log ) ) { self::$log = wc_get_logger(); } - self::$log->log( $level, $message, array( 'tag' => 'paypal' ) ); + self::$log->log( $level, $message, array( 'source' => 'paypal' ) ); } } diff --git a/includes/log-handlers/class-wc-log-handler-db.php b/includes/log-handlers/class-wc-log-handler-db.php index 5c5eb39faaf..d5431c21511 100644 --- a/includes/log-handlers/class-wc-log-handler-db.php +++ b/includes/log-handlers/class-wc-log-handler-db.php @@ -23,20 +23,20 @@ class WC_Log_Handler_DB extends WC_Log_Handler { * @param array $context { * Additional information for log handlers. * - * @type string $tag Optional. Tag will be available in log table. Default ''; + * @type string $source Optional. Source will be available in log table. Default ''; * } * * @return bool False if value was not handled and true if value was handled. */ public function handle( $timestamp, $level, $message, $context ) { - if ( isset( $context['tag'] ) && $context['tag'] ) { - $tag = $context['tag']; + if ( isset( $context['source'] ) && $context['source'] ) { + $source = $context['source']; } else { - $tag = ''; + $source = ''; } - return $this->add( $timestamp, $level, $message, $tag, $context ); + return $this->add( $timestamp, $level, $message, $source, $context ); } /** @@ -45,21 +45,21 @@ class WC_Log_Handler_DB extends WC_Log_Handler { * @param int $timestamp Log timestamp. * @param string $level emergency|alert|critical|error|warning|notice|info|debug * @param string $message Log message. - * @param string $tag Log tag. Useful for filtering and sorting. + * @param string $source Log source. Useful for filtering and sorting. * @param array $context { * Context will be serialized and stored in database. * } * * @return bool True if write was successful. */ - protected static function add( $timestamp, $level, $message, $tag, $context ) { + protected static function add( $timestamp, $level, $message, $source, $context ) { global $wpdb; $insert = array( 'timestamp' => date( 'Y-m-d H:i:s', $timestamp ), 'level' => WC_Log_Levels::get_level_severity( $level ), 'message' => $message, - 'tag' => $tag, + 'source' => $source, ); $format = array( diff --git a/includes/log-handlers/class-wc-log-handler-file.php b/includes/log-handlers/class-wc-log-handler-file.php index 993c4a9282e..8510180b9f2 100644 --- a/includes/log-handlers/class-wc-log-handler-file.php +++ b/includes/log-handlers/class-wc-log-handler-file.php @@ -76,7 +76,7 @@ class WC_Log_Handler_File extends WC_Log_Handler { * @param array $context { * Additional information for log handlers. * - * @type string $tag Optional. Determines log file to write to. Default 'log'. + * @type string $source Optional. Determines log file to write to. Default 'log'. * @type bool $_legacy Optional. Default false. True to use outdated log format * orignally used in deprecated WC_Logger::add calls. * } @@ -85,8 +85,8 @@ class WC_Log_Handler_File extends WC_Log_Handler { */ public function handle( $timestamp, $level, $message, $context ) { - if ( isset( $context['tag'] ) && $context['tag'] ) { - $handle = $context['tag']; + if ( isset( $context['source'] ) && $context['source'] ) { + $handle = $context['source']; } else { $handle = 'log'; } @@ -109,8 +109,8 @@ class WC_Log_Handler_File extends WC_Log_Handler { protected static function format_entry( $timestamp, $level, $message, $context ) { if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) { - if ( isset( $context['tag'] ) && $context['tag'] ) { - $handle = $context['tag']; + if ( isset( $context['source'] ) && $context['source'] ) { + $handle = $context['source']; } else { $handle = 'log'; } diff --git a/tests/unit-tests/log/log-handler-db.php b/tests/unit-tests/log/log-handler-db.php index 7e27a73b0c2..75ed13c4f8d 100644 --- a/tests/unit-tests/log/log-handler-db.php +++ b/tests/unit-tests/log/log-handler-db.php @@ -24,18 +24,18 @@ class WC_Tests_Log_Handler_DB extends WC_Unit_Test_Case { $time = time(); $context = array( 1, 2, 'a', 'b', 'key' => 'value' ); - $handler->handle( $time, 'debug', 'msg_debug', array( 'tag' => 'tag_debug' ) ); - $handler->handle( $time, 'info', 'msg_info', array( 'tag' => 'tag_info' ) ); - $handler->handle( $time, 'notice', 'msg_notice', array( 'tag' => 'tag_notice' ) ); - $handler->handle( $time, 'warning', 'msg_warning', array( 'tag' => 'tag_warning' ) ); - $handler->handle( $time, 'error', 'msg_error', array( 'tag' => 'tag_error' ) ); - $handler->handle( $time, 'critical', 'msg_critical', array( 'tag' => 'tag_critical' ) ); - $handler->handle( $time, 'alert', 'msg_alert', array( 'tag' => 'tag_alert' ) ); - $handler->handle( $time, 'emergency', 'msg_emergency', array( 'tag' => 'tag_emergency' ) ); + $handler->handle( $time, 'debug', 'msg_debug', array( 'source' => 'source_debug' ) ); + $handler->handle( $time, 'info', 'msg_info', array( 'source' => 'source_info' ) ); + $handler->handle( $time, 'notice', 'msg_notice', array( 'source' => 'source_notice' ) ); + $handler->handle( $time, 'warning', 'msg_warning', array( 'source' => 'source_warning' ) ); + $handler->handle( $time, 'error', 'msg_error', array( 'source' => 'source_error' ) ); + $handler->handle( $time, 'critical', 'msg_critical', array( 'source' => 'source_critical' ) ); + $handler->handle( $time, 'alert', 'msg_alert', array( 'source' => 'source_alert' ) ); + $handler->handle( $time, 'emergency', 'msg_emergency', array( 'source' => 'source_emergency' ) ); $handler->handle( $time, 'debug', 'context_test', $context ); - $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, tag, context FROM {$wpdb->prefix}woocommerce_log", ARRAY_A ); + $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, source, context FROM {$wpdb->prefix}woocommerce_log", ARRAY_A ); $expected_ts = date( 'Y-m-d H:i:s', $time ); $expected = array( @@ -43,63 +43,63 @@ class WC_Tests_Log_Handler_DB extends WC_Unit_Test_Case { 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'debug' ), 'message' => 'msg_debug', - 'tag' => 'tag_debug', - 'context' => serialize( array( 'tag' => 'tag_debug' ) ), + 'source' => 'source_debug', + 'context' => serialize( array( 'source' => 'source_debug' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'info' ), 'message' => 'msg_info', - 'tag' => 'tag_info', - 'context' => serialize( array( 'tag' => 'tag_info' ) ), + 'source' => 'source_info', + 'context' => serialize( array( 'source' => 'source_info' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'notice' ), 'message' => 'msg_notice', - 'tag' => 'tag_notice', - 'context' => serialize( array( 'tag' => 'tag_notice' ) ), + 'source' => 'source_notice', + 'context' => serialize( array( 'source' => 'source_notice' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'warning' ), 'message' => 'msg_warning', - 'tag' => 'tag_warning', - 'context' => serialize( array( 'tag' => 'tag_warning' ) ), + 'source' => 'source_warning', + 'context' => serialize( array( 'source' => 'source_warning' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'error' ), 'message' => 'msg_error', - 'tag' => 'tag_error', - 'context' => serialize( array( 'tag' => 'tag_error' ) ), + 'source' => 'source_error', + 'context' => serialize( array( 'source' => 'source_error' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'critical' ), 'message' => 'msg_critical', - 'tag' => 'tag_critical', - 'context' => serialize( array( 'tag' => 'tag_critical' ) ), + 'source' => 'source_critical', + 'context' => serialize( array( 'source' => 'source_critical' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'alert' ), 'message' => 'msg_alert', - 'tag' => 'tag_alert', - 'context' => serialize( array( 'tag' => 'tag_alert' ) ), + 'source' => 'source_alert', + 'context' => serialize( array( 'source' => 'source_alert' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'emergency' ), 'message' => 'msg_emergency', - 'tag' => 'tag_emergency', - 'context' => serialize( array( 'tag' => 'tag_emergency' ) ), + 'source' => 'source_emergency', + 'context' => serialize( array( 'source' => 'source_emergency' ) ), ), array( 'timestamp' => $expected_ts, 'level' => WC_Log_Levels::get_level_severity( 'debug' ), 'message' => 'context_test', - 'tag' => '', + 'source' => '', 'context' => serialize( $context ), ), ); @@ -121,12 +121,12 @@ class WC_Tests_Log_Handler_DB extends WC_Unit_Test_Case { $handler->handle( $time, 'debug', '', array() ); - $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, tag FROM {$wpdb->prefix}woocommerce_log" ); + $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, source FROM {$wpdb->prefix}woocommerce_log" ); $this->assertCount( 1, $log_entries ); WC_Log_Handler_DB::flush(); - $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, tag FROM {$wpdb->prefix}woocommerce_log" ); + $log_entries = $wpdb->get_results( "SELECT timestamp, level, message, source FROM {$wpdb->prefix}woocommerce_log" ); $this->assertCount( 0, $log_entries ); } diff --git a/tests/unit-tests/log/log-handler-file.php b/tests/unit-tests/log/log-handler-file.php index c722d9ea347..97dd9d2484b 100644 --- a/tests/unit-tests/log/log-handler-file.php +++ b/tests/unit-tests/log/log-handler-file.php @@ -47,7 +47,7 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { public function test_legacy_format() { $handler = new WC_Log_Handler_File( array( 'threshold' => 'debug' ) ); - $handler->handle( time(), 'info', 'this is a message', array( 'tag' => 'unit-tests', '_legacy' => true ) ); + $handler->handle( time(), 'info', 'this is a message', array( 'source' => 'unit-tests', '_legacy' => true ) ); $this->assertStringMatchesFormat( '%d-%d-%d @ %d:%d:%d - %s', $this->read_content( 'unit-tests' ) ); $this->assertStringEndsWith( ' - this is a message' . PHP_EOL, $this->read_content( 'unit-tests' ) ); @@ -61,7 +61,7 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { public function test_clear() { $handler = new WC_Log_Handler_File(); $log_name = '_test_clear'; - $handler->handle( time(), 'debug', 'debug', array( 'tag' => $log_name ) ); + $handler->handle( time(), 'debug', 'debug', array( 'source' => $log_name ) ); $handler->clear( $log_name ); $this->assertEquals( '', $this->read_content( $log_name ) ); } @@ -74,7 +74,7 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { public function test_remove() { $handler = new WC_Log_Handler_File(); $log_name = '_test_remove'; - $handler->handle( time(), 'debug', 'debug', array( 'tag' => $log_name ) ); + $handler->handle( time(), 'debug', 'debug', array( 'source' => $log_name ) ); $handler->remove( $log_name ); $this->assertFileNotExists( WC_Log_Handler_File::get_log_file_path( $log_name ) ); } @@ -102,23 +102,23 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { } /** - * Test 'tag' context determines log file. + * Test 'source' context determines log file. * * @since 2.7.0 */ - public function test_log_file_tag() { + public function test_log_file_source() { $handler = new WC_Log_Handler_File(); $time = time(); - $context_tag = array( 'tag' => 'unit-tests' ); + $context_source = array( 'source' => 'unit-tests' ); - $handler->handle( $time, 'debug', 'debug', $context_tag ); - $handler->handle( $time, 'info', 'info', $context_tag ); - $handler->handle( $time, 'notice', 'notice', $context_tag ); - $handler->handle( $time, 'warning', 'warning', $context_tag ); - $handler->handle( $time, 'error', 'error', $context_tag ); - $handler->handle( $time, 'critical', 'critical', $context_tag ); - $handler->handle( $time, 'alert', 'alert', $context_tag ); - $handler->handle( $time, 'emergency', 'emergency', $context_tag ); + $handler->handle( $time, 'debug', 'debug', $context_source ); + $handler->handle( $time, 'info', 'info', $context_source ); + $handler->handle( $time, 'notice', 'notice', $context_source ); + $handler->handle( $time, 'warning', 'warning', $context_source ); + $handler->handle( $time, 'error', 'error', $context_source ); + $handler->handle( $time, 'critical', 'critical', $context_source ); + $handler->handle( $time, 'alert', 'alert', $context_source ); + $handler->handle( $time, 'emergency', 'emergency', $context_source ); $log_content = $this->read_content( 'unit-tests' ); $this->assertStringMatchesFormatFile( dirname( __FILE__ ) . '/test_log_expected.txt', $log_content ); @@ -133,17 +133,17 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { $handler_a = new WC_Log_Handler_File(); $handler_b = new WC_Log_Handler_File(); $time = time(); - $context_tag = array( 'tag' => 'unit-tests' ); + $context_source = array( 'source' => 'unit-tests' ); // Different loggers should not conflict. - $handler_a->handle( $time, 'debug', 'debug', $context_tag ); - $handler_b->handle( $time, 'info', 'info', $context_tag ); - $handler_a->handle( $time, 'notice', 'notice', $context_tag ); - $handler_b->handle( $time, 'warning', 'warning', $context_tag ); - $handler_a->handle( $time, 'error', 'error', $context_tag ); - $handler_b->handle( $time, 'critical', 'critical', $context_tag ); - $handler_a->handle( $time, 'alert', 'alert', $context_tag ); - $handler_b->handle( $time, 'emergency', 'emergency', $context_tag ); + $handler_a->handle( $time, 'debug', 'debug', $context_source ); + $handler_b->handle( $time, 'info', 'info', $context_source ); + $handler_a->handle( $time, 'notice', 'notice', $context_source ); + $handler_b->handle( $time, 'warning', 'warning', $context_source ); + $handler_a->handle( $time, 'error', 'error', $context_source ); + $handler_b->handle( $time, 'critical', 'critical', $context_source ); + $handler_a->handle( $time, 'alert', 'alert', $context_source ); + $handler_b->handle( $time, 'emergency', 'emergency', $context_source ); $log_content = $this->read_content( 'unit-tests' ); $this->assertStringMatchesFormatFile( dirname( __FILE__ ) . '/test_log_expected.txt', $log_content ); @@ -175,8 +175,8 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case { file_put_contents( WC_Log_Handler_File::get_log_file_path( $log_name . ".{$i}" ), $i ); } - $context_tag = array( 'tag' => $log_name ); - $handler->handle( $time, 'emergency', 'emergency', $context_tag ); + $context_source = array( 'source' => $log_name ); + $handler->handle( $time, 'emergency', 'emergency', $context_source ); $this->assertFileExists( WC_Log_Handler_File::get_log_file_path( $log_name ) ); diff --git a/tests/unit-tests/log/logger.php b/tests/unit-tests/log/logger.php index aa10aa9d213..aa1a666b833 100644 --- a/tests/unit-tests/log/logger.php +++ b/tests/unit-tests/log/logger.php @@ -25,7 +25,7 @@ class WC_Tests_Logger extends WC_Unit_Test_Case { $this->greaterThanOrEqual( $time ), $this->equalTo( 'notice' ), $this->equalTo( 'this is a message' ), - $this->equalTo( array( 'tag' => 'unit-tests', '_legacy' => true ) ) + $this->equalTo( array( 'source' => 'unit-tests', '_legacy' => true ) ) ); $log = new WC_Logger( array( $handler ), 'debug' );