Back to Log class

Method registerLogger

public void
registerLogger
(string $key, string $class, bool $replace = false)
Register a logger to the registry
Parameters
  • string $key The service key to be registered
  • string $class The class name of the logger
  • bool $replace Flag indicating the service key may replace an existing definition
Returns
  • void
Since
  • 4.0.0
Class: Log
Project: Joomla

Method registerLogger - Source code

/**
 * Register a logger to the registry
 *
 * @param   string   $key      The service key to be registered
 * @param   string   $class    The class name of the logger
 * @param   boolean  $replace  Flag indicating the service key may replace an existing definition
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function registerLogger(string $key, string $class, bool $replace = false)
{
    // Automatically instantiate the singleton object if not already done.
    if (empty(static::$instance)) {
        static::setInstance(new static());
    }
    static::$instance->loggerRegistry->register($key, $class, $replace);
}