Back to Log class

Method setInstance

public static void
setInstance
(mixed $instance)
Returns a reference to the a Log object, only creating it if it doesn't already exist.
Parameters
  • \Joomla\CMS\Log\Log $instance The logging object instance to be used by the static methods.
Returns
  • void
Since
  • 1.7.0
Class: Log
Project: Joomla

Method setInstance - Source code

/**
 * Returns a reference to the a Log object, only creating it if it doesn't already exist.
 * Note: This is principally made available for testing and internal purposes.
 *
 * @param   Log  $instance  The logging object instance to be used by the static methods.
 *
 * @return  void
 *
 * @since   1.7.0
 */
public static function setInstance($instance)
{
    if ($instance instanceof Log || $instance === null) {
        static::$instance =& $instance;
    }
}