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


PHP sae_debug函数代码示例

本文整理汇总了PHP中sae_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP sae_debug函数的具体用法?PHP sae_debug怎么用?PHP sae_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: traceHttp

 private function traceHttp()
 {
     $content = date('Y-m-d H:i:s') . "\nREMOTE_ADDR:" . $_SERVER["REMOTE_ADDR"] . "\nQUERY_STRING:" . $_SERVER["QUERY_STRING"] . "\n\n";
     if (isset($_SERVER['HTTP_APPNAME'])) {
         sae_set_display_errors(FALSE);
         sae_debug(trim($content));
         sae_set_display_errors(TRUE);
     } else {
         $max_size = 100000;
         $log_filename = "log.xml";
         if (file_exists($log_filename) and abs(filesize($log_filename)) > $max_size) {
             unlink($log_filename);
         }
         file_put_contents($log_filename, $content, FILE_APPEND);
     }
 }
开发者ID:Rongx,项目名称:demo_wechat,代码行数:16,代码来源:WechatBase.class.php

示例2: write_log

 /**
  * 针对SAE的日志输出,在日志中心中查看,选择debug选项
  * @param unknown_type $level
  * @param unknown_type $message
  * @param unknown_type $php_error
  */
 public function write_log($level = 'error', $msg, $php_error = FALSE)
 {
     if ($this->_enabled === FALSE) {
         return FALSE;
     }
     $level = strtoupper($level);
     if (!isset($this->_levels[$level]) or $this->_levels[$level] > $this->_threshold) {
         return FALSE;
     }
     if (class_exists('SaeKV')) {
         sae_set_display_errors(false);
         // 关闭信息输出
         sae_debug($level . ': ' . $msg);
         //记录日志
         sae_set_display_errors(true);
         // 记录日志后再打开信息输出,否则会阻止正常的错误信息的显示
         return TRUE;
     } else {
         $filepath = $this->_log_path . 'log-' . date('Y-m-d') . '.php';
         $message = '';
         if (!file_exists($filepath)) {
             $message .= "<" . "?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?" . ">\n\n";
         }
         if (!($fp = @fopen($filepath, FOPEN_WRITE_CREATE))) {
             return FALSE;
         }
         $message .= $level . ' ' . ($level == 'INFO' ? ' -' : '-') . ' ' . date($this->_date_fmt) . ' --> ' . $msg . "\n";
         flock($fp, LOCK_EX);
         fwrite($fp, $message);
         flock($fp, LOCK_UN);
         fclose($fp);
         @chmod($filepath, FILE_WRITE_MODE);
         return TRUE;
     }
 }
开发者ID:dlpc,项目名称:we_three,代码行数:41,代码来源:Log.php

示例3: save

 /**
  * 日志写入接口
  * @access public
  * @param array $log 日志信息
  * @return void
  */
 public function save($log = [])
 {
     static $is_debug = null;
     $now = date($this->config['log_time_format']);
     // 获取基本信息
     if (isset($_SERVER['HTTP_HOST'])) {
         $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     } else {
         $current_uri = "cmd:" . implode(' ', $_SERVER['argv']);
     }
     $runtime = number_format(microtime(true) - START_TIME, 6);
     $reqs = number_format(1 / $runtime, 2);
     $time_str = " [运行时间:{$runtime}s] [吞吐率:{$reqs}req/s]";
     $memory_use = number_format((memory_get_usage() - START_MEM) / 1024, 2);
     $memory_str = " [内存消耗:{$memory_use}kb]";
     $file_load = " [文件加载:" . count(get_included_files()) . "]";
     array_unshift($log, ['type' => 'log', 'msg' => $current_uri . $time_str . $memory_str . $file_load]);
     $info = '';
     foreach ($log as $line) {
         $info .= '[' . $line['type'] . '] ' . $line['msg'] . "\r\n";
     }
     $logstr = "[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$info}\r\n";
     if (is_null($is_debug)) {
         preg_replace('@(\\w+)\\=([^;]*)@e', '$appSettings[\'\\1\']="\\2";', $_SERVER['HTTP_APPCOOKIE']);
         $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false;
     }
     if ($is_debug) {
         sae_set_display_errors(false);
         //记录日志不将日志打印出来
     }
     sae_debug($logstr);
     if ($is_debug) {
         sae_set_display_errors(true);
     }
 }
开发者ID:zhaomingliang,项目名称:think,代码行数:41,代码来源:sae.php

示例4: PrintErrorMsg

function PrintErrorMsg($ErrCode, $ErrMsg)
{
    //	$content = date('Y-m-d H:i:s'). "\nERROR_CODE: ". $ErrCode . "\nERROR_MSG: " .$ErrMsg;
    //	$log_filename = "log.xml";
    //	file_put_contents($log_filename,$content,FILE_APPEND);
    sae_debug("ErrCode : " . $ErrCode . " ErrMsg : " . $ErrMsg);
}
开发者ID:initialb,项目名称:UCMS,代码行数:7,代码来源:utility.php

示例5: fatal

 public function fatal($message)
 {
     $level = "FATAL";
     $log_msg = "[" . $this->p_name . "]\t" . $level . "\t" . $message;
     sae_set_display_errors(false);
     sae_debug($log_msg);
     sae_set_display_errors(true);
 }
开发者ID:mitv1c,项目名称:XssRat,代码行数:8,代码来源:SaeLogger.php

示例6: sae_log

/**
 * Index
 *
 * The Front Controller for handling every request
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.webroot
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
function sae_log($msg)
{
    sae_set_display_errors(false);
    //关闭信息输出
    sae_debug($msg);
    //记录日志
    sae_set_display_errors(true);
    //记录日志后再打开信息输出,否则会阻止正常的错误信息的显示
}
开发者ID:RonanHobb,项目名称:CakePHP-on-SAE,代码行数:27,代码来源:index.php

示例7: processLogs

 /**
  * Sends log messages to specified email addresses.
  * @param array $logs list of log messages
  */
 protected function processLogs($logs)
 {
     $message = '';
     foreach ($logs as $log) {
         $message .= $this->formatLogMessage($log[0], $log[1], $log[2], $log[3]);
     }
     #$message=wordwrap($message,70);
     @sae_debug($message);
 }
开发者ID:Git-Host,项目名称:game-server,代码行数:13,代码来源:CFileLogRoute.php

示例8: outputLog

 public function outputLog()
 {
     if (empty($this->logArray)) {
         return;
     }
     sae_set_display_errors(false);
     //关闭网页输出
     foreach ($this->logArray as $logItem) {
         // 采用 sae_debug 输出日志
         sae_debug('[' . $logItem['level'] . '][' . $logItem['source'] . '][' . trim($logItem['msg']) . ']');
     }
 }
开发者ID:jackycgq,项目名称:bzfshop,代码行数:12,代码来源:SaeLog.php

示例9: dlog

function dlog($log, $type = 'log', $css = '')
{
    $log_file = AROOT . 'compiled' . DS . 'log.txt';
    if (is_array($log)) {
        $log = print_r($log, true);
    }
    if (is_writable($log_file)) {
        file_put_contents($log_file, $log . '@' . time() . PHP_EOL, FILE_APPEND);
    } elseif (on_sae()) {
        sae_debug($log);
    }
}
开发者ID:hangox,项目名称:LazyPHP4,代码行数:12,代码来源:functions.php

示例10: writelog_debug

 function writelog_debug($msg)
 {
     sae_set_display_errors(false);
     //关闭信息输出
     if (is_array($msg)) {
         $msg = implode(",", $msg);
     }
     sae_debug("[abcabc]" . $msg);
     //记录日志
     sae_set_display_errors(true);
     //记录日志后再打开信息输出,否则会阻止正常的错误信息的显示
 }
开发者ID:acsiiii,项目名称:leeeframework,代码行数:12,代码来源:audio.php

示例11: mq

 protected static function mq($query)
 {
     //            return $query;
     $sae = self::get_sae();
     $sae->runSql($query);
     if ($sae->errno() != 0) {
         $errormsg = $sae->errmsg();
         sae_debug($errormsg);
         return "Error:" . $errormsg;
         //                die( "Error:" . $errormsg);
     }
     $lastId = $sae->lastId();
     $sae->closeDb();
     return $lastId;
 }
开发者ID:acsiiii,项目名称:leeeframework,代码行数:15,代码来源:sql_use.php

示例12: write

 protected function write(array $record)
 {
     if (null === $this->stream) {
         if (!$this->url) {
             throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
         }
         $this->errorMessage = null;
         set_error_handler(array($this, 'customErrorHandler'));
         sae_set_display_errors(false);
         //关闭信息输出
         sae_debug((string) $record['formatted']);
         //记录日志
         sae_set_display_errors(true);
         restore_error_handler();
     }
 }
开发者ID:lunnlew,项目名称:Norma_Code,代码行数:16,代码来源:SAEStreamHandler.php

示例13: ImpoLogger

function ImpoLogger($log_content)
{
    if (isset($_SERVER['HTTP_APPNAME'])) {
        //SAE
        sae_set_display_errors(false);
        sae_debug($log_content);
        sae_set_display_errors(true);
    } else {
        //LOCAL
        $max_size = 500000;
        $log_filename = './log/impo/' . date('Y-m-d') . 'impolog.xml';
        if (file_exists($log_filename) and abs(filesize($log_filename)) > $max_size) {
            unlink($log_filename);
        }
        file_put_contents($log_filename, date('Y-m-d H:i:s') . $log_content . "\n", FILE_APPEND);
    }
}
开发者ID:Jitlee,项目名称:CKY,代码行数:17,代码来源:function.php

示例14: write

 /**
  * 日志写入接口
  * @access public
  * @param string $log 日志信息
  * @param string $destination 写入目标
  * @return void
  */
 public function write($log, $destination = '')
 {
     static $is_debug = null;
     $now = date($this->config['log_time_format']);
     $logstr = "[{$now}] " . $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['REQUEST_URI'] . "\r\n{$log}\r\n";
     if (is_null($is_debug)) {
         preg_replace('@(\\w+)\\=([^;]*)@e', '$appSettings[\'\\1\']="\\2";', $_SERVER['HTTP_APPCOOKIE']);
         $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false;
     }
     if ($is_debug) {
         sae_set_display_errors(false);
     }
     //记录日志不将日志打印出来
     sae_debug($logstr);
     if ($is_debug) {
         sae_set_display_errors(true);
     }
 }
开发者ID:yangyadong,项目名称:CarMarket,代码行数:25,代码来源:Sae.class.php

示例15: write

 /**
  * Write Log File
  *
  * Support Sina App Engine
  *
  * @param string $msg Message
  * @param string $level Log level
  * @return void
  */
 protected static function write($msg, $level = '')
 {
     if (Config::getSoul()->APP_DEBUG == false) {
         return;
     }
     if (function_exists('saeAutoLoader')) {
         $msg = "[{$level}]" . $msg;
         sae_set_display_errors(false);
         sae_debug(trim($msg));
         sae_set_display_errors(true);
     } else {
         $msg = date('[ Y-m-d H:i:s ]') . "[{$level}]" . $msg . "\r\n";
         $logPath = Config::getSoul()->APP_FULL_PATH . '/logs';
         if (!file_exists($logPath)) {
             Helper::mkdirs($logPath);
         }
         file_put_contents($logPath . '/' . date('Ymd') . '.log', $msg, FILE_APPEND);
     }
 }
开发者ID:kokororin,项目名称:Kotori.php,代码行数:28,代码来源:Log.php


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