當前位置: 首頁>>代碼示例>>PHP>>正文


PHP false::log方法代碼示例

本文整理匯總了PHP中false::log方法的典型用法代碼示例。如果您正苦於以下問題:PHP false::log方法的具體用法?PHP false::log怎麽用?PHP false::log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在false的用法示例。


在下文中一共展示了false::log方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: log

 private static function log($level, $string, $statsLog = false)
 {
     if (php_sapi_name() === 'cli' || defined('STDIN')) {
         // we are being executed from the CLI, nowhere to log
         return;
     }
     if (self::$loggingHandler === null) {
         // Initialize logging
         self::createLoggingHandler();
         if (!empty(self::$earlyLog)) {
             error_log('----------------------------------------------------------------------');
             // output messages which were logged before we properly initialized logging
             foreach (self::$earlyLog as $msg) {
                 self::log($msg['level'], $msg['string'], $msg['statsLog']);
             }
         }
     } elseif (self::$loggingHandler === false) {
         // some error occurred while initializing logging
         if (empty(self::$earlyLog)) {
             // this is the first message
             error_log('--- Log message(s) while initializing logging ------------------------');
         }
         error_log($string);
         self::defer($level, $string, $statsLog);
         return;
     }
     if (self::$captureLog) {
         $ts = microtime(true);
         $msecs = (int) (($ts - (int) $ts) * 1000);
         $ts = GMdate('H:i:s', $ts) . sprintf('.%03d', $msecs) . 'Z';
         self::$capturedLog[] = $ts . ' ' . $string;
     }
     if (self::$logLevel >= $level || $statsLog) {
         if (is_array($string)) {
             $string = implode(",", $string);
         }
         $formats = array('%trackid', '%msg', '%srcip', '%stat');
         $replacements = array(self::$trackid, $string, $_SERVER['REMOTE_ADDR']);
         $stat = '';
         if ($statsLog) {
             $stat = 'STAT ';
         }
         array_push($replacements, $stat);
         if (self::$trackid === self::NO_TRACKID && !self::$shuttingDown) {
             // we have a log without track ID and we are not still shutting down, so defer logging
             self::defer($level, $string, $statsLog);
             return;
         } elseif (self::$trackid === self::NO_TRACKID) {
             // shutting down without a track ID, prettify it
             array_shift($replacements);
             array_unshift($replacements, 'N/A');
         }
         // we either have a track ID or we are shutting down, so just log the message
         $string = str_replace($formats, $replacements, self::$format);
         self::$loggingHandler->log($level, $string);
     }
 }
開發者ID:PitcherAG,項目名稱:simplesamlphp,代碼行數:57,代碼來源:Logger.php

示例2: log

 private static function log($level, $string, $statsLog = false)
 {
     if (php_sapi_name() === 'cli' || defined('STDIN')) {
         // we are being executed from the CLI, nowhere to log
         return;
     }
     if (self::$loggingHandler === null) {
         /* Initialize logging. */
         self::createLoggingHandler();
         if (!empty(self::$earlyLog)) {
             error_log('----------------------------------------------------------------------');
             // output messages which were logged before we properly initialized logging
             foreach (self::$earlyLog as $msg) {
                 self::log($msg['level'], $msg['string'], $msg['statsLog']);
             }
         }
     } elseif (self::$loggingHandler === false) {
         // some error occurred while initializing logging
         if (empty(self::$earlyLog)) {
             // this is the first message
             error_log('--- Log message(s) while initializing logging ------------------------');
         }
         error_log($string);
         self::$earlyLog[] = array('level' => $level, 'string' => $string, 'statsLog' => $statsLog);
         return;
     }
     if (self::$captureLog) {
         $ts = microtime(true);
         $msecs = (int) (($ts - (int) $ts) * 1000);
         $ts = GMdate('H:i:s', $ts) . sprintf('.%03d', $msecs) . 'Z';
         self::$capturedLog[] = $ts . ' ' . $string;
     }
     if (self::$logLevel >= $level || $statsLog) {
         if (is_array($string)) {
             $string = implode(",", $string);
         }
         $formats = array('%trackid', '%msg', '%srcip', '%stat');
         $replacements = array(self::getTrackId(), $string, $_SERVER['REMOTE_ADDR']);
         $stat = '';
         if ($statsLog) {
             $stat = 'STAT ';
         }
         array_push($replacements, $stat);
         $string = str_replace($formats, $replacements, self::$format);
         self::$loggingHandler->log($level, $string);
     }
 }
開發者ID:tractorcow,項目名稱:simplesamlphp,代碼行數:47,代碼來源:Logger.php

示例3: _log

 /**
  * Log an error using PEAR::Log
  * @param array $err Error array
  * @param array $levels Error level => Log constant map
  * @access protected
  */
 protected function _log($err, $levels = array('exception' => PEAR_LOG_CRIT, 'alert' => PEAR_LOG_ALERT, 'critical' => PEAR_LOG_CRIT, 'error' => PEAR_LOG_ERR, 'warning' => PEAR_LOG_WARNING, 'notice' => PEAR_LOG_NOTICE, 'info' => PEAR_LOG_INFO, 'debug' => PEAR_LOG_DEBUG))
 {
     if (isset($levels[$err['level']])) {
         $level = $levels[$err['level']];
     } else {
         $level = PEAR_LOG_INFO;
     }
     if ($this->_logger) {
         $this->_logger->log($err['message'], $level, $err);
     } else {
         self::$globallogger->log($err['message'], $level, $err);
     }
 }
開發者ID:madberry,項目名稱:WhiteLabelTransfer,代碼行數:19,代碼來源:ErrorStack5.php

示例4: array

 /**
  * Log an error using PEAR::Log
  * @param array $err Error array
  * @param array $levels Error level => Log constant map
  * @access protected
  */
 function _log($err, $levels = array('exception' => PEAR_LOG_CRIT, 'alert' => PEAR_LOG_ALERT, 'critical' => PEAR_LOG_CRIT, 'error' => PEAR_LOG_ERR, 'warning' => PEAR_LOG_WARNING, 'notice' => PEAR_LOG_NOTICE, 'info' => PEAR_LOG_INFO, 'debug' => PEAR_LOG_DEBUG))
 {
     if (isset($levels[$err['level']])) {
         $level = $levels[$err['level']];
     } else {
         $level = PEAR_LOG_INFO;
     }
     if ($this->_logger) {
         $this->_logger->log($err['message'], $level, $err);
     } else {
         $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']->log($err['message'], $level, $err);
     }
 }
開發者ID:hendricson,項目名稱:couponator,代碼行數:19,代碼來源:ErrorStack.php

示例5: logError

 /**
  * Log error message
  * @param string $message
  */
 public function logError($message)
 {
     if (!$this->_log) {
         return;
     }
     $this->_log->log(get_called_class() . ': ' . $message);
 }
開發者ID:vgrish,項目名稱:dvelum,代碼行數:11,代碼來源:Model.php


注:本文中的false::log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。