Commit ebdca18d authored by alexpott's avatar alexpott

Issue #2324791 by Michael Hodge Jr, ParisLiakos: Remove watchdog().

parent 6d58240b
......@@ -68,7 +68,6 @@
* @see http://bugs.php.net/bug.php?id=18090
* @see http://php.net/manual/function.syslog.php
* @see http://php.net/manual/network.constants.php
* @see watchdog()
* @see watchdog_severity_levels()
*/
......@@ -757,8 +756,7 @@ function request_uri($omit_query_string = FALSE) {
/**
* Logs an exception.
*
* This is a wrapper function for watchdog() which automatically decodes an
* exception.
* This is a wrapper logging function which automatically decodes an exception.
*
* @param $type
* The category to which this message belongs.
......@@ -776,7 +774,6 @@ function request_uri($omit_query_string = FALSE) {
* @param $link
* A link to associate with the message.
*
* @see watchdog()
* @see \Drupal\Core\Utility\Error::decodeException()
*/
function watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $severity = WATCHDOG_ERROR, $link = NULL) {
......@@ -798,49 +795,6 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia
\Drupal::logger($type)->log($severity, $message, $variables);
}
/**
* Logs a system message.
*
* @param $type
* The category to which this message belongs. Can be any string, but the
* general practice is to use the name of the module calling watchdog().
* @param $message
* The message to store in the log. Keep $message translatable
* by not concatenating dynamic values into it! Variables in the
* message should be added by using placeholder strings alongside
* the variables argument to declare the value of the placeholders.
* See t() for documentation on how $message and $variables interact.
* @param $variables
* Array of variables to replace in the message on display or array() if
* message is already translated or not possible to translate.
* @param $severity
* The severity of the message; one of the following values as defined in
* @link http://www.faqs.org/rfcs/rfc3164.html RFC 3164: @endlink
* - WATCHDOG_EMERGENCY: Emergency, system is unusable.
* - WATCHDOG_ALERT: Alert, action must be taken immediately.
* - WATCHDOG_CRITICAL: Critical conditions.
* - WATCHDOG_ERROR: Error conditions.
* - WATCHDOG_WARNING: Warning conditions.
* - WATCHDOG_NOTICE: (default) Normal but significant conditions.
* - WATCHDOG_INFO: Informational messages.
* - WATCHDOG_DEBUG: Debug-level messages.
* @param $link
* A link to associate with the message.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::logger($channel)->log($severity, $message, $context), or any
* of the shortcut methods of \Psr\Log\LoggerTrait.
*
* @see watchdog_severity_levels()
* @see hook_watchdog()
*/
function watchdog($type, $message, array $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
if ($link) {
$variables['link'] = $link;
}
\Drupal::service('logger.factory')->get($type)->log($severity, $message, $variables);
}
/**
* Sets a message to display to the user.
*
......
......@@ -3358,8 +3358,9 @@ function element_set_attributes(array &$element, array $map) {
* Array of the possible severity levels for log messages.
*
* @see http://www.ietf.org/rfc/rfc3164.txt
* @see watchdog()
* @ingroup logging_severity_levels
*
* @todo Move this in https://www.drupal.org/node/2267545 in \Drupal\Core\Log.
*/
function watchdog_severity_levels() {
return array(
......
......@@ -29,7 +29,7 @@ class LoggerChannel implements LoggerChannelInterface {
/**
* Map of PSR Log constants to Watchdog log constants.
*
* @todo Move watchdog constants here when watchdog() is removed.
* @todo Move watchdog constants here in https://www.drupal.org/node/2267545.
*
* @var array
*/
......
......@@ -7,8 +7,6 @@
* The Database Logging module monitors your site and keeps a list of recorded
* events containing usage and performance data, errors, warnings, and similar
* operational information.
*
* @see watchdog()
*/
use Drupal\Core\Form\FormStateInterface;
......
......@@ -457,7 +457,7 @@ protected function testDBLogAddAndClear() {
// Add a watchdog entry.
$this->container->get('logger.dblog')->log($log['severity'], $log['message'], $log);
// Make sure the table count has actually been incremented.
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count)));
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('\Drupal\dblog\Logger\DbLog->log() added an entry to the dblog :count', array(':count' => $count)));
// Login the admin user.
$this->drupalLogin($this->big_user);
// Post in order to clear the database table.
......
......@@ -165,7 +165,6 @@ function assertModules(array $modules, $enabled) {
/**
* Verify a log entry was entered for a module's status change.
* Called in the same way of the expected original watchdog() execution.
*
* @param $type
* The category to which this message belongs.
......
......@@ -12,23 +12,17 @@
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
// @todo Remove once watchdog() is removed.
// @todo Remove in https://www.drupal.org/node/2267545.
if (!defined('WATCHDOG_EMERGENCY')) {
define('WATCHDOG_EMERGENCY', 0);
define('WATCHDOG_ALERT', 1);
define('WATCHDOG_CRITICAL', 2);
define('WATCHDOG_ERROR', 3);
define('WATCHDOG_WARNING', 4);
define('WATCHDOG_NOTICE', 5);
define('WATCHDOG_INFO', 6);
define('WATCHDOG_DEBUG', 7);
}
// WATCHDOG_NOTICE is also defined in FormValidatorTest, so check independently.
if (!defined('WATCHDOG_NOTICE')) {
define('WATCHDOG_NOTICE', 5);
}
// WATCHDOG_ERROR is also defined in FormBuilderTest, so check independently.
if (!defined('WATCHDOG_ERROR')) {
define('WATCHDOG_ERROR', 3);
}
/**
* @coversDefaultClass \Drupal\Core\Logger\LoggerChannelFactory
......
......@@ -13,23 +13,17 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
// @todo Remove once watchdog() is removed.
// @todo Remove in https://www.drupal.org/node/2267545.
if (!defined('WATCHDOG_EMERGENCY')) {
define('WATCHDOG_EMERGENCY', 0);
define('WATCHDOG_ALERT', 1);
define('WATCHDOG_CRITICAL', 2);
define('WATCHDOG_ERROR', 3);
define('WATCHDOG_WARNING', 4);
define('WATCHDOG_NOTICE', 5);
define('WATCHDOG_INFO', 6);
define('WATCHDOG_DEBUG', 7);
}
// WATCHDOG_NOTICE is also defined in FormValidatorTest, so check independently.
if (!defined('WATCHDOG_NOTICE')) {
define('WATCHDOG_NOTICE', 5);
}
// WATCHDOG_ERROR is also defined in FormBuilderTest, so check independently.
if (!defined('WATCHDOG_ERROR')) {
define('WATCHDOG_ERROR', 3);
}
/**
* @coversDefaultClass \Drupal\Core\Logger\LoggerChannel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment