PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tools/swift/Swift/LogContainer.php

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