This is a small class to wrap a zend log, so we dont have to call the registry and the logger to log a message.
With this, instead of :
$logger = Zend_Registry::get('log'); $logger->info($message);
we can do:
ZC_FileLogger::info($message);
The full class:
<?php class ZC_FileLogger { /** * * @var Zend_Log */ protected $logger; /** * * @var ZC_FileLogger */ static $fileLogger = null; public static function getInstance() { if (self::$fileLogger === null) { self::$fileLogger = new self(); } return self::$fileLogger; } /** * * @return Zend_Log */ public function getLog() { return $this->logger; } protected function __construct() { $this->logger = Zend_Registry::get('log'); } /** * log a message * @param string $message */ public static function info($message) { self::getInstance()->getLog()->info($message); } }