From e0dd98a5046df320b2e5245c79d29a8863b17cac Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 23 Jun 2014 11:36:07 +1200 Subject: [PATCH] CRM-14850 tidy up ufLogging by declaring the capability on the class --- CRM/Utils/System/Base.php | 14 ++++++++++++++ CRM/Utils/System/DrupalBase.php | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index b6091a5cde..c64d11173b 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -8,6 +8,13 @@ abstract class CRM_Utils_System_Base { var $is_joomla = FALSE; var $is_wordpress = FALSE; + /** + * Does this CMS / UF support a CMS specific logging mechanism? + * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions + * @var bool + */ + var $supports_UF_Logging = FALSE; + /* * Does the CMS allow CMS forms to be extended by hooks */ @@ -320,5 +327,12 @@ abstract class CRM_Utils_System_Base { function outputError($content) { echo CRM_Utils_System::theme($content); } + + /** + * Log error to CMS + */ + function logger($message) { + + } } diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index fd3523ccbf..cc05a46f42 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -37,6 +37,13 @@ * Drupal specific stuff goes here */ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { + + /** + * Does this CMS / UF support a CMS specific logging mechanism? + * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions + * @var bool + */ + var $supports_UF_Logging = TRUE; /** * */ @@ -260,4 +267,14 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { return TRUE; } } + + + /** + * Log error to CMS + */ + function logger($message) { + if (CRM_Core_Config::singleton()->userFrameworkLogging) { + watchdog('civicrm', $message, NULL, WATCHDOG_DEBUG); + } + } } -- 2.25.1