1<?php 2 3/** 4 * A registry for the logger object. 5 * Please read the LICENSE file 6 * @author Chris Corbyn <chris@w3style.co.uk> 7 * @package Swift_Log 8 * @license GNU Lesser General Public License 9 */ 10 11require_once dirname(__FILE__) . "/ClassLoader.php"; 12Swift_ClassLoader::load("Swift_Log_DefaultLog"); 13 14/** 15 * A registry holding the current instance of the log. 16 * @package Swift_Log 17 * @author Chris Corbyn <chris@w3style.co.uk> 18 */ 19class Swift_LogContainer 20{ 21 /** 22 * The log instance. 23 * @var Swift_Log 24 */ 25 protected static $log = null; 26 27 /** 28 * Registers the logger. 29 * @param Swift_Log The log 30 */ 31 public static function setLog(Swift_Log $log) 32 { 33 self::$log = $log; 34 } 35 /** 36 * Returns the current instance of the log, or lazy-loads the default one. 37 * @return Swift_Log 38 */ 39 public static function getLog() 40 { 41 if (self::$log === null) 42 { 43 self::setLog(new Swift_Log_DefaultLog()); 44 } 45 return self::$log; 46 } 47} 48