diff --git a/src/DrupalMemcache.php b/src/DrupalMemcache.php index 9089e7d..2a618ed 100644 --- a/src/DrupalMemcache.php +++ b/src/DrupalMemcache.php @@ -91,7 +91,7 @@ class DrupalMemcache extends DrupalMemcacheBase { $results = @$this->memcache->get($full_keys); if (!empty($php_errormsg)) { - register_shutdown_function([$this, 'deferWarning'], 'Exception caught in DrupalMemcache::getMulti: !msg', ['!msg' => $php_errormsg]); + $this->logger->warning('Exception caught in DrupalMemcache::getMulti: !msg', ['!msg' => $php_errormsg]); $php_errormsg = ''; } diff --git a/src/DrupalMemcacheBase.php b/src/DrupalMemcacheBase.php index 2feb2b9..932df22 100644 --- a/src/DrupalMemcacheBase.php +++ b/src/DrupalMemcacheBase.php @@ -78,7 +78,7 @@ abstract class DrupalMemcacheBase implements DrupalMemcacheInterface { $result = @$this->memcache->get($full_key); if (!empty($php_errormsg)) { - register_shutdown_function([$this, 'deferWarning'], 'Exception caught in DrupalMemcacheBase::get: !msg', ['!msg' => $php_errormsg]); + $this->logger->warning('Exception caught in DrupalMemcacheBase::get: !msg', ['!msg' => $php_errormsg]); $php_errormsg = ''; } ini_set('track_errors', $track_errors); @@ -118,19 +118,4 @@ abstract class DrupalMemcacheBase implements DrupalMemcacheInterface { $this->memcache->flush(); } - /** - * Deferred message logging. - * - * In bootstrap phase, where watchdog is non-functional. This method can be - * registered so the message gets recorded at the end of the page load. - * - * @param string $message - * The message to log. - * @param array $context - * The variables associated with the message. - */ - protected function deferWarning($message, array $context) { - $this->logger->warn($message, $context); - } - } diff --git a/src/DrupalMemcacheFactory.php b/src/DrupalMemcacheFactory.php index 87cf07f..c18759a 100644 --- a/src/DrupalMemcacheFactory.php +++ b/src/DrupalMemcacheFactory.php @@ -122,10 +122,7 @@ class DrupalMemcacheFactory { } if (!$init) { - // We can't use watchdog because this happens in a bootstrap phase - // where watchdog is non-functional. Register a shutdown handler - // instead so it gets recorded at the end of page load. - register_shutdown_function([$this, 'deferWarning'], 'Failed to connect to memcache server: !server', ['!server' => $s]); + $this->logger->warning('Failed to connect to memcache server: !server', ['!server' => $s]); $this->failedConnectionCache[$s] = FALSE; } } @@ -198,19 +195,4 @@ class DrupalMemcacheFactory { $this->memcacheCache = array(); } - /** - * Deferred message logging. - * - * In bootstrap phase, where watchdog is non-functional. This method can be - * registered so the message gets recorded at the end of the page load. - * - * @param string $message - * The message to log. - * @param array $context - * The variables associated with the message. - */ - protected function deferWarning($message, array $context) { - $this->logger->warn($message, $context); - } - }