From 05316b849a9ca1efb99f2533c605ce42f0c48697 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 13 Sep 2018 12:57:14 -0700 Subject: [PATCH] Drop wfErrorLog, deprecated in 1.25 Change-Id: I29131f3c677ab5747ac0ae5121669af63a1d5bd8 --- RELEASE-NOTES-1.32 | 2 ++ includes/GlobalFunctions.php | 20 ------------------- includes/debug/logger/LegacyLogger.php | 16 ++++----------- .../debug/logger/monolog/LegacyFormatter.php | 6 +++--- .../debug/logger/monolog/LegacyHandler.php | 2 +- 5 files changed, 10 insertions(+), 36 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 60f5e6abf1..c32aa496ed 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -323,6 +323,8 @@ because of Phabricator reports. * The '--tidy' option to maintenance/parse.php has been removed. Tidying the output is now the default. Use '--no-tidy' to bypass the tidy phase. +* The global function wfErrorLog, deprecated since 1.25, has now been removed. + Use MWLoggerLegacyLogger::emit or UDPTransport. === Deprecations in 1.32 === * HTMLForm::setSubmitProgressive() is deprecated. No need to call it. Submit diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 336cb89e99..c769b0ab3f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1147,26 +1147,6 @@ function wfLogWarning( $msg, $callerOffset = 1, $level = E_USER_WARNING ) { MWDebug::warning( $msg, $callerOffset + 1, $level, 'production' ); } -/** - * Log to a file without getting "file size exceeded" signals. - * - * Can also log to TCP or UDP with the syntax udp://host:port/prefix. This will - * send lines to the specified port, prefixed by the specified prefix and a space. - * @since 1.25 support for additional context data - * - * @param string $text - * @param string $file Filename - * @param array $context Additional logging context data - * @throws MWException - * @deprecated since 1.25 Use \MediaWiki\Logger\LegacyLogger::emit or UDPTransport - */ -function wfErrorLog( $text, $file, array $context = [] ) { - wfDeprecated( __METHOD__, '1.25' ); - $logger = LoggerFactory::getInstance( 'wfErrorLog' ); - $context['destination'] = $file; - $logger->info( trim( $text ), $context ); -} - /** * @todo document * @todo Move logic to MediaWiki.php diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index d4a79d931f..9d0789c4dc 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -29,7 +29,7 @@ use Psr\Log\LogLevel; use UDPTransport; /** - * PSR-3 logger that mimics the historic implementation of MediaWiki's + * PSR-3 logger that mimics the historic implementation of MediaWiki's former * wfErrorLog logging implementation. * * This logger is configured by the following global configuration variables: @@ -145,10 +145,6 @@ class LegacyLogger extends AbstractLogger { // specfied. $shouldEmit = (bool)$wgDBerrorLog; - } elseif ( $channel === 'wfErrorLog' ) { - // All messages on the wfErrorLog channel should be emitted. - $shouldEmit = true; - } elseif ( $channel === 'wfDebug' ) { // wfDebug messages are emitted if a catch all logging file has // been specified. Checked explicitly so that 'private' flagged @@ -192,10 +188,9 @@ class LegacyLogger extends AbstractLogger { /** * Format a message. * - * Messages to the 'wfDebug', 'wfLogDBError' and 'wfErrorLog' channels - * receive special formatting to mimic the historic output of the functions - * of the same name. All other channel values are formatted based on the - * historic output of the `wfDebugLog()` global function. + * Messages to the 'wfDebug' and 'wfLogDBError' channels receive special formatting to mimic the + * historic output of the functions of the same name. All other channel values are formatted + * based on the historic output of the `wfDebugLog()` global function. * * @param string $channel * @param string $message @@ -211,9 +206,6 @@ class LegacyLogger extends AbstractLogger { } elseif ( $channel === 'wfLogDBError' ) { $text = self::formatAsWfLogDBError( $channel, $message, $context ); - } elseif ( $channel === 'wfErrorLog' ) { - $text = "{$message}\n"; - } elseif ( $channel === 'profileoutput' ) { // Legacy wfLogProfilingData formatitng $forward = ''; diff --git a/includes/debug/logger/monolog/LegacyFormatter.php b/includes/debug/logger/monolog/LegacyFormatter.php index 92624a0b3d..3cf6e466d2 100644 --- a/includes/debug/logger/monolog/LegacyFormatter.php +++ b/includes/debug/logger/monolog/LegacyFormatter.php @@ -24,9 +24,9 @@ use MediaWiki\Logger\LegacyLogger; use Monolog\Formatter\NormalizerFormatter; /** - * Log message formatter that mimics the legacy log message formatting of - * `wfDebug`, `wfDebugLog`, `wfLogDBError` and `wfErrorLog` global functions by - * delegating the formatting to \MediaWiki\Logger\LegacyLogger. + * Log message formatter that mimics the legacy log message formatting of `wfDebug`, `wfDebugLog`, + * `wfLogDBError` and the former `wfErrorLog` global functions by delegating the formatting to + * \MediaWiki\Logger\LegacyLogger. * * @since 1.25 * @copyright © 2013 Wikimedia Foundation and contributors diff --git a/includes/debug/logger/monolog/LegacyHandler.php b/includes/debug/logger/monolog/LegacyHandler.php index dbeb13691a..258a9a887e 100644 --- a/includes/debug/logger/monolog/LegacyHandler.php +++ b/includes/debug/logger/monolog/LegacyHandler.php @@ -27,7 +27,7 @@ use Monolog\Logger; use UnexpectedValueException; /** - * Log handler that replicates the behavior of MediaWiki's wfErrorLog() + * Log handler that replicates the behavior of MediaWiki's former wfErrorLog() * logging service. Log output can be directed to a local file, a PHP stream, * or a udp2log server. * -- 2.20.1