X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi.php;h=a018bb54d9d2ef2ff07fd2f682688783a3b13de7;hb=dabcbaf3025a734a1809b55adf8e44d9819e0890;hp=95009e35c3fd3df36ba03e43dca7b844d78b9818;hpb=5ef139aa041f9ca1e7ebd6d915b0e232ba961526;p=civicrm-core.git diff --git a/Civi.php b/Civi.php index 95009e35c3..a018bb54d9 100644 --- a/Civi.php +++ b/Civi.php @@ -64,7 +64,14 @@ class Civi { * @return \Symfony\Component\EventDispatcher\EventDispatcherInterface */ public static function dispatcher() { - return Civi\Core\Container::singleton()->get('dispatcher'); + // NOTE: The dispatcher object is initially created as a boot service + // (ie `dispatcher.boot`). For compatibility with the container (eg + // `RegisterListenersPass` and `createEventDispatcher` addons), + // it is also available as the `dispatcher` service. + // + // The 'dispatcher.boot' and 'dispatcher' services are the same object, + // but 'dispatcher.boot' is resolvable earlier during bootstrap. + return Civi\Core\Container::getBootService('dispatcher.boot'); } /** @@ -75,10 +82,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); } /**