APIv4 - Add useTrash option to soft-delete contacts
[civicrm-core.git] / Civi.php
index f916756883ed7ae8c40756847a70a471576490df..f087d19c8d6b00ceefb777d1b1d81c86d94ef44a 100644 (file)
--- a/Civi.php
+++ b/Civi.php
@@ -1,5 +1,7 @@
 <?php
 
+use Civi\Core\Format;
+
 /**
  * Class Civi
  *
@@ -82,10 +84,16 @@ class Civi {
   }
 
   /**
-   * @return \CRM_Core_Error_Log
+   * Find or create a logger.
+   *
+   * @param string $channel
+   *   Symbolic name (or channel) of the intended log.
+   *   This should correlate to a service "log.{NAME}".
+   *
+   * @return \Psr\Log\LoggerInterface
    */
-  public static function log() {
-    return Civi\Core\Container::singleton()->get('psr_log');
+  public static function log($channel = 'default') {
+    return \Civi\Core\Container::singleton()->get('psr_log_manager')->getLog($channel);
   }
 
   /**
@@ -97,6 +105,15 @@ class Civi {
     return \Civi\Core\Container::getBootService('paths');
   }
 
+  /**
+   * Obtain the formatting object.
+   *
+   * @return \Civi\Core\Format
+   */
+  public static function format(): Format {
+    return new Civi\Core\Format();
+  }
+
   /**
    * Fetch a service from the container.
    *