Skip to content
Snippets Groups Projects
Unverified Commit 00259be4 authored by DaveD's avatar DaveD Committed by GitHub
Browse files

Merge pull request #25573 from herbdool/core-4127-3

#4127 move is_drupal to use userSystem logger
parents 63c54bbb b12cc0c7
Branches
Tags
No related merge requests found
......@@ -598,13 +598,7 @@ class CRM_Core_Error extends PEAR_ErrorStack {
}
if (!empty(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
// should call $config->userSystem->logger($message) here - but I got a situation where userSystem was not an object - not sure why
if ($config->userSystem->is_drupal and function_exists('watchdog')) {
watchdog('civicrm', '%message', ['%message' => $message], $priority ?? WATCHDOG_DEBUG);
}
elseif ($config->userSystem->is_drupal and CIVICRM_UF == 'Drupal8') {
\Drupal::logger('civicrm')->log($priority ?? \Drupal\Core\Logger\RfcLogLevel::DEBUG, '%message', ['%message' => $message]);
}
$config->userSystem->logger($message, $priority);
}
return $str;
......
......@@ -923,8 +923,9 @@ abstract class CRM_Utils_System_Base {
* Log error to CMS.
*
* @param string $message
* @param string|NULL $priority
*/
public function logger($message) {
public function logger($message, $priority = NULL) {
}
/**
......
......@@ -537,6 +537,15 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
return 'sidebar_first';
}
/**
* @inheritDoc
*/
public function logger($message, $priority = NULL) {
if (CRM_Core_Config::singleton()->userFrameworkLogging) {
\Drupal::logger('civicrm')->log($priority ?? \Drupal\Core\Logger\RfcLogLevel::DEBUG, '%message', ['%message' => $message]);
}
}
/**
* @inheritDoc
*/
......
......@@ -269,9 +269,9 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
/**
* @inheritDoc
*/
public function logger($message) {
if (CRM_Core_Config::singleton()->userFrameworkLogging && function_exists('watchdog')) {
watchdog('civicrm', '%message', ['%message' => $message], NULL, WATCHDOG_DEBUG);
public function logger($message, $priority = NULL) {
if (CRM_Core_Config::singleton()->userFrameworkLogging) {
watchdog('civicrm', '%message', ['%message' => $message], $priority ?? WATCHDOG_DEBUG);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment