当前位置: 首页>>代码示例>>PHP>>正文


PHP Debug::logHandle方法代码示例

本文整理汇总了PHP中Debug::logHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::logHandle方法的具体用法?PHP Debug::logHandle怎么用?PHP Debug::logHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Debug的用法示例。


在下文中一共展示了Debug::logHandle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processException

 /**
  * Logs or displays exception.
  * @param  Exception
  * @param  bool  is writing to standard output buffer allowed?
  * @return void
  */
 public static function processException(Exception $exception, $outputAllowed = FALSE)
 {
     if (self::$logFile) {
         error_log("PHP Fatal error:  Uncaught {$exception}");
         $file = @strftime('%d-%b-%Y %H-%M-%S ', Debug::$time) . strstr(number_format(Debug::$time, 4, '~', ''), '~');
         $file = dirname(self::$logFile) . "/exception {$file}.html";
         self::$logHandle = @fopen($file, 'x');
         if (self::$logHandle) {
             ob_start(array(__CLASS__, 'writeFile'), 1);
             self::paintBlueScreen($exception);
             ob_end_flush();
             fclose(self::$logHandle);
         }
         if (self::$sendEmails) {
             self::sendEmail((string) $exception);
         }
     } elseif (self::$productionMode) {
         // be quiet
     } elseif (self::$consoleMode) {
         // dump to console
         if ($outputAllowed) {
             echo "{$exception}\n";
             foreach (self::$colophons as $callback) {
                 foreach ((array) call_user_func($callback, 'bluescreen') as $line) {
                     echo strip_tags($line) . "\n";
                 }
             }
         }
     } elseif (self::$firebugDetected && self::$ajaxDetected && !headers_sent()) {
         // AJAX mode
         self::fireLog($exception, self::EXCEPTION);
     } elseif ($outputAllowed) {
         // dump to browser
         self::paintBlueScreen($exception);
     } elseif (self::$firebugDetected && !headers_sent()) {
         self::fireLog($exception, self::EXCEPTION);
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:44,代码来源:Debug.php

示例2: processException

 /**
  * Logs or displays exception.
  * @param  Exception
  * @param  bool  is writing to standard output buffer allowed?
  * @return void
  */
 public static function processException(Exception $exception, $outputAllowed = FALSE)
 {
     if (!self::$enabled) {
         return;
     } elseif (self::$logFile) {
         try {
             $hash = md5($exception . (method_exists($exception, 'getPrevious') ? $exception->getPrevious() : (isset($exception->previous) ? $exception->previous : '')));
             self::log("PHP Fatal error: Uncaught " . str_replace("Stack trace:\n" . $exception->getTraceAsString(), '', $exception));
             foreach (new DirectoryIterator(dirname(self::$logFile)) as $entry) {
                 if (strpos($entry, $hash)) {
                     $skip = TRUE;
                     break;
                 }
             }
             $file = dirname(self::$logFile) . "/exception " . @date('Y-m-d H-i-s') . " {$hash}.html";
             if (empty($skip) && (self::$logHandle = @fopen($file, 'w'))) {
                 ob_start();
                 // double buffer prevents sending HTTP headers in some PHP
                 ob_start(array(__CLASS__, '_writeFile'), 1);
                 self::_paintBlueScreen($exception);
                 ob_end_flush();
                 ob_end_clean();
                 fclose(self::$logHandle);
             }
             if (self::$sendEmails) {
                 self::sendEmail((string) $exception);
             }
         } catch (Exception $e) {
             if (!headers_sent()) {
                 header('HTTP/1.1 500 Internal Server Error');
             }
             echo 'Debug fatal error: ', get_class($e), ': ', ($e->getCode() ? '#' . $e->getCode() . ' ' : '') . $e->getMessage(), "\n";
             exit;
         }
     } elseif (self::$productionMode) {
         // be quiet
     } elseif (self::$consoleMode) {
         // dump to console
         if ($outputAllowed) {
             echo "{$exception}\n";
         }
     } elseif (self::$firebugDetected && self::$ajaxDetected && !headers_sent()) {
         // AJAX mode
         self::fireLog($exception, self::EXCEPTION);
     } elseif ($outputAllowed) {
         // dump to browser
         if (!headers_sent()) {
             @ob_end_clean();
             while (ob_get_level() && @ob_end_clean()) {
             }
             if (in_array('Content-Encoding: gzip', headers_list())) {
                 header('Content-Encoding: identity', TRUE);
             }
             // override gzhandler
         }
         self::_paintBlueScreen($exception);
     } elseif (self::$firebugDetected && !headers_sent()) {
         self::fireLog($exception, self::EXCEPTION);
     }
     foreach (self::$onFatalError as $handler) {
         call_user_func($handler, $exception);
     }
 }
开发者ID:regiss,项目名称:texyla-s-Nete1-PhP-5.2,代码行数:69,代码来源:Debug.php

示例3: exceptionHandler

 /**
  * Debug exception handler.
  *
  * @param  Exception
  * @return void
  */
 public static function exceptionHandler(Exception $exception)
 {
     if (!headers_sent()) {
         header('HTTP/1.1 500 Internal Server Error');
     }
     if (self::$logFile) {
         // log to file
         error_log("PHP Fatal error:  Uncaught {$exception}");
         $file = @strftime('%d-%b-%Y %H-%M-%S ', Debug::$time) . strstr(number_format(Debug::$time, 4, '~', ''), '~');
         $file = dirname(self::$logFile) . "/exception {$file}.html";
         self::$logHandle = @fopen($file, 'x');
         if (self::$logHandle) {
             ob_start(array(__CLASS__, 'writeFile'), 1);
             self::paintBlueScreen($exception);
             ob_end_flush();
             fclose(self::$logHandle);
         }
         self::observeErrorLog();
     } elseif (!self::$html || isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
         // console or AJAX mode
         if (self::$useFirebug && !headers_sent()) {
             self::fireLog($exception);
         } else {
             echo "{$exception}\n";
             foreach (self::$colophons as $callback) {
                 foreach ((array) call_user_func($callback, 'bluescreen') as $line) {
                     echo strip_tags($line) . "\n";
                 }
             }
         }
     } else {
         // dump to screen
         while (ob_get_level() && @ob_end_clean()) {
         }
         self::paintBlueScreen($exception);
         exit;
     }
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:44,代码来源:Debug.php

示例4: processException

 static function processException(Exception $exception, $outputAllowed = FALSE)
 {
     if (!self::$enabled) {
         return;
     } elseif (self::$logFile) {
         try {
             $hash = md5($exception . (method_exists($exception, 'getPrevious') ? $exception->getPrevious() : (isset($exception->previous) ? $exception->previous : '')));
             error_log("PHP Fatal error:  Uncaught {$exception}");
             foreach (new DirectoryIterator(dirname(self::$logFile)) as $entry) {
                 if (strpos($entry, $hash)) {
                     $skip = TRUE;
                     break;
                 }
             }
             $file = dirname(self::$logFile) . "/exception " . @date('Y-m-d H-i-s') . " {$hash}.html";
             if (empty($skip) && (self::$logHandle = @fopen($file, 'x'))) {
                 ob_start();
                 ob_start(array(__CLASS__, '_writeFile'), 1);
                 self::_paintBlueScreen($exception);
                 ob_end_flush();
                 ob_end_clean();
                 fclose(self::$logHandle);
             }
             if (self::$sendEmails) {
                 self::sendEmail((string) $exception);
             }
         } catch (Exception $e) {
             if (!headers_sent()) {
                 header('HTTP/1.1 500 Internal Server Error');
             }
             echo 'Nette\\Debug fatal error: ', get_class($e), ': ', ($e->getCode() ? '#' . $e->getCode() . ' ' : '') . $e->getMessage(), "\n";
             exit;
         }
     } elseif (self::$productionMode) {
     } elseif (self::$consoleMode) {
         if ($outputAllowed) {
             echo "{$exception}\n";
             foreach (self::$colophons as $callback) {
                 foreach ((array) call_user_func($callback, 'bluescreen') as $line) {
                     echo strip_tags($line) . "\n";
                 }
             }
         }
     } elseif (self::$firebugDetected && self::$ajaxDetected && !headers_sent()) {
         self::fireLog($exception, self::EXCEPTION);
     } elseif ($outputAllowed) {
         if (!headers_sent()) {
             @ob_end_clean();
             while (ob_get_level() && @ob_end_clean()) {
             }
             if (in_array('Content-Encoding: gzip', headers_list())) {
                 header('Content-Encoding: identity', TRUE);
             }
         }
         self::_paintBlueScreen($exception);
     } elseif (self::$firebugDetected && !headers_sent()) {
         self::fireLog($exception, self::EXCEPTION);
     }
     foreach (self::$onFatalError as $handler) {
         call_user_func($handler, $exception);
     }
 }
开发者ID:romcok,项目名称:google-translator,代码行数:62,代码来源:loader.php

示例5: log

 /**
  * Logs message or exception to file (if set) and sends e-mail notification (if enabled).
  * @param  string|Exception
  * @param  int
  * @return void
  */
 public static function log($message, $priority = self::INFO)
 {
     if (!self::$logFile) {
         return;
     }
     if ($message instanceof Exception) {
         $exception = $message;
         $message = "PHP Fatal error: Uncaught exception " . get_class($exception) . " with message '" . $exception->getMessage() . "' in " . $exception->getFile() . ":" . $exception->getLine();
     }
     error_log(@date('[Y-m-d H-i-s] ') . trim($message) . (self::$source ? '  @  ' . self::$source : '') . PHP_EOL, 3, self::$logFile);
     if ($priority === self::ERROR && self::$sendEmails && @filemtime(self::$logFile . '.email-sent') + self::$emailSnooze < time() && @file_put_contents(self::$logFile . '.email-sent', 'sent')) {
         // @ - file may not be writable
         call_user_func(self::$mailer, $message);
     }
     if (isset($exception)) {
         $hash = md5($exception . (method_exists($exception, 'getPrevious') ? $exception->getPrevious() : (isset($exception->previous) ? $exception->previous : '')));
         foreach (new DirectoryIterator(dirname(self::$logFile)) as $entry) {
             if (strpos($entry, $hash)) {
                 $skip = TRUE;
                 break;
             }
         }
         if (empty($skip) && (self::$logHandle = @fopen(dirname(self::$logFile) . "/exception " . @date('Y-m-d H-i-s') . " {$hash}.html", 'w'))) {
             ob_start();
             // double buffer prevents sending HTTP headers in some PHP
             ob_start(array(__CLASS__, '_writeFile'), 1);
             self::_paintBlueScreen($exception);
             ob_end_flush();
             ob_end_clean();
             fclose(self::$logHandle);
         }
     }
 }
开发者ID:radypala,项目名称:maga-website,代码行数:39,代码来源:Debug.php

示例6: processException

 /**
  * Logs or displays exception.
  * @param  Exception
  * @param  bool  is writing to standard output buffer allowed?
  * @return void
  */
 public static function processException(Exception $exception, $outputAllowed = FALSE)
 {
     if (!self::$enabled) {
         return;
     } elseif (self::$logFile) {
         error_log("PHP Fatal error:  Uncaught {$exception}");
         $file = @strftime('%d-%b-%Y %H-%M-%S ', self::$time) . strstr(number_format(self::$time, 4, '~', ''), '~');
         $file = dirname(self::$logFile) . "/exception {$file}.html";
         self::$logHandle = @fopen($file, 'x');
         if (self::$logHandle) {
             ob_start(array(__CLASS__, '_writeFile'), 1);
             self::_paintBlueScreen($exception);
             ob_end_flush();
             fclose(self::$logHandle);
         }
         if (self::$sendEmails) {
             self::sendEmail((string) $exception);
         }
     } elseif (self::$productionMode) {
         // be quiet
     } elseif (self::$consoleMode) {
         // dump to console
         if ($outputAllowed) {
             echo "{$exception}\n";
             foreach (self::$colophons as $callback) {
                 foreach ((array) call_user_func($callback, 'bluescreen') as $line) {
                     echo strip_tags($line) . "\n";
                 }
             }
         }
     } elseif (self::$firebugDetected && self::$ajaxDetected && !headers_sent()) {
         // AJAX mode
         self::fireLog($exception, self::EXCEPTION);
     } elseif ($outputAllowed) {
         // dump to browser
         if (!headers_sent()) {
             @ob_end_clean();
             while (ob_get_level() && @ob_end_clean()) {
             }
             if (in_array('Content-Encoding: gzip', headers_list())) {
                 header('Content-Encoding: identity', TRUE);
             }
             // override gzhandler
         }
         self::_paintBlueScreen($exception);
     } elseif (self::$firebugDetected && !headers_sent()) {
         self::fireLog($exception, self::EXCEPTION);
     }
     foreach (self::$onFatalError as $handler) {
         call_user_func($handler, $exception);
     }
 }
开发者ID:romcok,项目名称:treeview,代码行数:58,代码来源:Debug.php


注:本文中的Debug::logHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。