CRM-14850 tidy up ufLogging by declaring the capability on the class
authorEileen McNaughton <eileen@fuzion.co.nz>
Sun, 22 Jun 2014 23:36:07 +0000 (11:36 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Sun, 22 Jun 2014 23:36:07 +0000 (11:36 +1200)
CRM/Utils/System/Base.php
CRM/Utils/System/DrupalBase.php

index b6091a5cde5922b29b2eba9ec3024895c2424ae9..c64d11173b08555afcb0bc288133f03e440014a9 100644 (file)
@@ -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) {
+
+  }
 }
 
index fd3523ccbf9a8be9a242da2fa36911d7e25e150d..cc05a46f424500f9e2c6c872130102284a158cf3 100644 (file)
  * 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);
+    }
+  }
 }