function &getLogger() { global $mcLogger, $man; if (isset($man)) { $mcLogger = $man->getLogger(); } if (!$mcLogger) { $mcLogger = new Moxiecode_Logger(); // Set logger options $mcLogger->setPath(dirname(__FILE__) . "/../logs"); $mcLogger->setMaxSize("100kb"); $mcLogger->setMaxFiles("10"); $mcLogger->setFormat("{time} - {message}"); } return $mcLogger; }
/** * Returns a logger instance. * * @return Logger New logger instance. */ function &getLogger() { if (!$this->_logger) { $log = new Moxiecode_Logger(); $null = null; // PHP why!!! Other languages can return null if (!checkBool($this->getConfigItem("log.enabled"))) { return $null; } // Set logger options $log->setLevel($this->getConfigItem("log.level", "fatal")); $log->setPath($this->toAbsPath($this->getConfigItem("log.path", "logs"))); $log->setFileName($this->getConfigItem("log.filename", "{level}.log")); $log->setFormat($this->getConfigItem("log.format", "[{time}] [{level}] {message}")); $log->setMaxSize($this->getConfigItem("log.max_size", "100k")); $log->setMaxFiles($this->getConfigItem("log.max_files", "10")); $this->_logger = $log; } return $this->_logger; }