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


PHP Log::save方法代码示例

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


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

示例1: testSave

 public function testSave()
 {
     Log::init(['type' => 'test']);
     Log::clear();
     Log::record('test');
     Log::record([1, 2, 3]);
     $this->assertTrue(Log::save());
 }
开发者ID:Lofanmi,项目名称:think,代码行数:8,代码来源:logTest.php

示例2: appShutdown

 /**
  * Shutdown Handler
  */
 public static function appShutdown()
 {
     if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) {
         // 将错误信息托管至think\ErrorException
         $exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']);
         self::appException($exception);
     }
     // 写入日志
     Log::save();
 }
开发者ID:top-think,项目名称:framework,代码行数:13,代码来源:Error.php

示例3: appShutdown

 /**
  * Shutdown Handler
  * @return bool true-禁止往下传播已处理过的异常; false-未处理的异常继续传播
  */
 public static function appShutdown()
 {
     // 写入日志
     Log::save();
     if ($error = error_get_last()) {
         // 将错误信息托管至think\ErrorException
         $exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']);
         /**
          * Shutdown handler 中的异常将不被往下传播
          * 所以,这里我们必须手动传播而不能像 Error handler 中那样 throw
          */
         self::appException($exception);
         // 禁止往下传播已处理过的异常
         return true;
     }
     return false;
 }
开发者ID:klsf,项目名称:kldns,代码行数:21,代码来源:Error.php

示例4: logDebug

 public function logDebug($message)
 {
     Log::write($message, 'DEBUG');
     Log::save();
 }
开发者ID:huzhengchuan,项目名称:pay,代码行数:5,代码来源:LogService.class.php

示例5: LoggerPrint

 protected function LoggerPrint($message, $level = 'ERROR')
 {
     Log::write($message, $level);
     Log::save();
 }
开发者ID:huzhengchuan,项目名称:trader,代码行数:5,代码来源:OrderController.class.php

示例6: mtReturn

 public function mtReturn($status, $info, $navTabId = '', $callbackType = 'closeCurrent', $forwardUrl = '', $rel = '', $type = '')
 {
     // 保证AJAX返回后也能保存日志
     if (C('LOG_RECORD')) {
         \Think\Log::save();
     }
     $result = array();
     if ($navTabId == '') {
         $navTabId = $_REQUEST['navTabId'];
     }
     if ($status == '200') {
         $this->sysLogs('', $info);
     }
     if ($status == '201') {
         $status = 200;
     }
     $result['statusCode'] = $status;
     // dwzjs
     $result['navTabId'] = $navTabId;
     // dwzjs
     $result['callbackType'] = $callbackType;
     // dwzjs
     $result['message'] = $info;
     // dwzjs
     $result['forwardUrl'] = $forwardUrl;
     $result['rel'] = $rel;
     if (empty($type)) {
         $type = C('DEFAULT_AJAX_RETURN');
     }
     if (strtoupper($type) == 'JSON') {
         // 返回JSON数据格式到客户端 包含状态信息
         header("Content-Type:text/html; charset=utf-8");
         exit(json_encode($result));
     } elseif (strtoupper($type) == 'XML') {
         // 返回xml格式数据
         header("Content-Type:text/xml; charset=utf-8");
         exit(xml_encode($result));
     } elseif (strtoupper($type) == 'EVAL') {
         // 返回可执行的js脚本
         header("Content-Type:text/html; charset=utf-8");
         exit($data);
     } else {
         // TODO 增加其它格式
     }
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:45,代码来源:CommonController.class.php

示例7: login

 /**
  * 登录
  */
 public function login()
 {
     $User = D("User");
     // 实例化User对象
     $userData = null;
     if (I("token") != null) {
         $User->validation(array(array('token', 'require', '令牌不能为空', Model::MUST_VALIDATE, 'regex'), array('token', '10,50', '令牌长度不正确', Model::MUST_VALIDATE, 'length')));
         $userData = $User->relation('privacy')->where("id = (select uid from t_thirdaccount where token = '%s')", I("token"))->field("id,token")->find();
         if (empty($userData)) {
             $this->retError(403, '没有对应的token');
         }
     } else {
         $User->validation(array(array('phonenumber', 'require', '手机号不能为空', Model::MUST_VALIDATE, 'regex'), array('password', 'require', '密码不能为空', Model::MUST_VALIDATE, 'regex'), array('password', '6,50', '密码长度不正确', Model::MUST_VALIDATE, 'length'), array('phonenumber', 'phonenumber', '手机号格式不正确', Model::MUST_VALIDATE, 'regex')));
         \Think\Log::record(I("phonenumber"));
         \Think\Log::record(md5(I('password')));
         \Think\Log::save();
         setLog(I("phonenumber"));
         $userData = $User->where("phonenumber='%s' and password = '%s'", I("phonenumber"), md5(I('password')))->field("id,token")->find();
         if (empty($userData)) {
             $this->retError(201, "帐号或密码错误");
         }
     }
     $this->retSuccess($userData);
 }
开发者ID:Emon0526,项目名称:zhuoying-wx,代码行数:27,代码来源:UserController.class.php

示例8: LogService

define('APP_PATH', './Yoga/');
// define('DIR_SECURE_FILENAME', 'default.html');
// define('BUILD_DIR_SECURE', false);
// define('BIND_MODULE', 'Channelmanager');
// define('BIND_CONTROLLER','Ptmanager');
// define('BUILD_CONTROLLER_LIST','Index,User,Brand');
define('RUNTIME_PATH', './Runtime/');
// define('STORAGE_TYPE','sae');
// define('APP_MODE','sae');//application mode
// //默认错误跳转对应的模板文件
// 'TMPL_ACTION_ERROR' => THINK_PATH . 'Tpl/dispatch_jump.tpl',
// //默认成功跳转对应的模板文件
// 'TMPL_ACTION_SUCCESS' => THINK_PATH . 'Tpl/dispatch_jump.tpl',
define('APP_STATUS', 'office');
// will load the status config file./application/Common/COnf/home.php
define('BUILD_LITE_FILE', true);
require "./LogService.class.php";
$ll = new LogService("request", "request");
$url = $_SERVER["REQUEST_URI"];
if ($url != "/Home/Task/checkTask") {
    $ll->debug($_SERVER["REQUEST_URI"]);
    if (!empty($_POST)) {
        $ll->debug($_POST);
    }
    if (!empty($_GET)) {
        $ll->debug($_GET);
    }
}
require './Framework/Core.php';
\Think\Log::save();
开发者ID:peterleezz,项目名称:test,代码行数:30,代码来源:index.php

示例9: returnMessage

function returnMessage($code, $msg, $ext = array())
{
    $success = $code == 200;
    $message = $ext;
    $message['status'] = $success ? 'true' : 'false';
    // 返回JSON数据格式到客户端 包含状态信息
    header('Content-Type:application/json; charset=utf-8');
    // 跨域 add 20150416 By NanQi
    header('Access-Control-Allow-Origin:*');
    header('Access-Control-Allow-Headers: X-Requested-With');
    if ($success) {
        $httpStatus = 200;
        $message['data'] = empty($msg) && !is_array($msg) ? '操作成功' : $msg;
    } else {
        //$message['errcode'] = $code;
        $message['errcode'] = empty($msg) ? '操作失败' : $msg;
        $status = substr($code, 0, 1);
        switch ($status) {
            case 2:
                $httpStatus = 201;
                break;
            case 3:
                $httpStatus = 202;
                break;
            case 4:
                $httpStatus = 203;
                break;
            case 5:
                \Think\Log::record('[' . $code . ']' . $msg);
                $httpStatus = 500;
                break;
            case 7:
                \Think\Log::record('[' . $code . ']' . $msg);
                $httpStatus = 501;
                break;
            case 9:
                \Think\Log::record('[' . $code . ']' . $msg);
                $httpStatus = 502;
                break;
        }
    }
    // 发送HTTP状态码
    send_http_status($httpStatus);
    G('request-end');
    $requertTime = G('initTime', 'request-end', 6);
    if ($requertTime > 0.3) {
        \Think\Log::record('[request-time] ' . $requertTime . 's');
        \Think\Log::record('[request-memory] ' . G('initTime', 'request-end', 'm') . 'kb');
    }
    \Think\Log::record('[Response] ' . $httpStatus);
    \Think\Log::save();
    exit(json_encode($message, 0));
}
开发者ID:Emon0526,项目名称:zhuoying-wx,代码行数:53,代码来源:functions.php

示例10: sae_log

function sae_log($key, $log)
{
    \Think\Log::record($key . ':' . $log);
    \Think\Log::save();
}
开发者ID:Emon0526,项目名称:zhuoying-wx,代码行数:5,代码来源:function.php


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