From 4b13e3b053a4422d2d5cc2ed9ee514884da7eb98 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 21 Dec 2016 20:35:25 +0100 Subject: [PATCH] Do not deprecate WC_Logger::add --- includes/class-wc-logger.php | 8 ++++---- tests/unit-tests/log/logger.php | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/class-wc-logger.php b/includes/class-wc-logger.php index 85877786348..1708b715c58 100644 --- a/includes/class-wc-logger.php +++ b/includes/class-wc-logger.php @@ -64,16 +64,16 @@ class WC_Logger { /** * Add a log entry. * - * @deprecated 2.7.0 + * This is not the preferred method for adding log messages. Please use log() or any one of + * the level methods (debug(), info(), etc.). This method may be deprecated in the future. * * @param string $handle * @param string $message * @return bool */ - public function add( $handle, $message ) { - wc_deprecated_function( 'WC_Logger::add', '2.7', 'WC_Logger::log' ); + public function add( $handle, $message, $level=WC_Log_Levels::NOTICE ) { $message = apply_filters( 'woocommerce_logger_add_message', $message, $handle ); - $this->log( WC_Log_Levels::NOTICE, $message, array( 'source' => $handle, '_legacy' => true ) ); + $this->log( $level, $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/tests/unit-tests/log/logger.php b/tests/unit-tests/log/logger.php index aa1a666b833..45f33c73c99 100644 --- a/tests/unit-tests/log/logger.php +++ b/tests/unit-tests/log/logger.php @@ -30,8 +30,6 @@ class WC_Tests_Logger extends WC_Unit_Test_Case { $log = new WC_Logger( array( $handler ), 'debug' ); $log->add( 'unit-tests', 'this is a message' ); - - $this->setExpectedDeprecated( 'WC_Logger::add' ); } /**