Esempio n. 1
0
 /**
  * 单例
  * @param array $config
  */
 public static function instance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
 /**
  * @param none
  * @return instance of Logger class
  */
 public static function GetInstance()
 {
     if (self::$_instance == NULL) {
         self::$_instance = new Logger();
     }
     return self::$_instance;
 }
 /**
  * Get an instance of the Logger object
  *
  * @return Object of this class
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         $className = __CLASS__;
         self::$_instance = new $className();
     }
     return self::$_instance;
 }
 /**
  * Get the unique instance that can be exist of this class.
  * Singleton software patter premise.
  *
  * @param \Doctrine\ORM\EntityManager $entityManager
  * @return type
  */
 public static function getInstance(\Doctrine\ORM\EntityManager $entityManager)
 {
     if (!isset($_instance)) {
         Logger::$_instance = new Logger();
     }
     Logger::$_instance->_entityManager = $entityManager;
     return Logger::$_instance;
 }
Esempio n. 5
0
 public static function log($level = self::INFO, $application, $action, $message, $writeMethod)
 {
     // nao faz login se USE_LOGGER eh falso
     if (USE_LOGGER === false) {
         return;
     }
     if (!isset(self::$_instance)) {
         self::$_instance = new Logger();
         self::$_dbinfo = isset($_SESSION['phpgw_info']['expressomail']['server']['loggerdb']) ? $_SESSION['phpgw_info']['expressomail']['server']['loggerdb'] : $GLOBALS['phpgw_info']['server']['loggerdb'];
     }
     $application = strtolower($application);
     $action = strtolower($action);
     if ($writeMethod === Logger::IN_DB) {
         self::$_instance->writeDB($level, $application, $action, $message);
     } else {
         self::$_instance->writeFile($level, $application, $action, $message);
     }
 }
 /**
  * Public method to get An instance of the Logger class
  * @return object
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }