Gpf_Log::addLogger PHP Method

addLogger() public static method

Attach new log system
public static addLogger ( string $type, string $logLevel ) : Gpf_Log_LoggerBase
$type string Gpf_Log_LoggerDisplay::TYPE Gpf_Log_LoggerFile::TYPE Gpf_Log_LoggerDatabase::TYPE
$logLevel string Gpf_Log::CRITICAL Gpf_Log::ERROR Gpf_Log::WARNING Gpf_Log::INFO Gpf_Log::DEBUG
return Gpf_Log_LoggerBase
        public static function addLogger($type, $logLevel)
        {
            if ($type instanceof Gpf_Log_LoggerBase) {
                return self::getLogger()->addLogger($type, $logLevel);
            }
            return self::getLogger()->add($type, $logLevel);
        }

Usage Example

Example #1
0
 public function getList() {
     try {
         return $this->transactionList->getHtml(10);
     } catch (Exception $e) {
         if (Gpf_Log::isLogToDisplay()) {
             Gpf_Log::critical('Report list, getHtml exception: ' . $e->getMessage());
         } else { 
             Gpf_Log::addLogger(Gpf_Log_LoggerDisplay::TYPE, Gpf_Log::CRITICAL);
             Gpf_Log::critical('Report list, getHtml exception: ' . $e->getMessage());
             Gpf_Log::disableType(Gpf_Log_LoggerDisplay::TYPE);
         }
         throw $e;
     }
 }
All Usage Examples Of Gpf_Log::addLogger