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


PHP log::prn_log方法代码示例

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


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

示例1: index

 public function index()
 {
     log::prn_log(DEBUG, json_encode($this->content));
     log::prn_log(DEBUG, json_encode($this->param));
     $db = $this->mysql;
     $result = $db->gearman_queue->insert(['unique_key' => 'd847233c-1ef2-11e5-9130-2c44fd7aee72', 'function_name' => 'test', 'priority' => 1, 'data' => 'test', 'when_to_run' => 0]);
     if ($result === false) {
         return 'error';
     }
     $result = $db->select_one("select * from gearman_queue where unique_key='d847233c-1ef2-11e5-9130-2c44fd7aee72'");
     if ($result === false) {
         return 'error';
     }
     var_dump($result);
     $result = $db->gearman_queue->update(['function_name' => 'testtest', 'priority' => 100, 'data' => 'testtesttesttest', 'when_to_run' => 100], ['unique_key' => 'd847233c-1ef2-11e5-9130-2c44fd7aee72']);
     if ($result === false) {
         return 'error';
     }
     var_dump($db->select_one("select * from gearman_queue where unique_key='d847233c-1ef2-11e5-9130-2c44fd7aee72'"));
     $result = $db->gearman_queue->delete(['unique_key' => 'd847233c-1ef2-11e5-9130-2c44fd7aee72']);
     if ($result === false) {
         return 'error';
     }
     $result = $db->select_more("select * from gearman_queue limit 3");
     if ($result === false) {
         return 'error';
     }
     var_dump($result);
     return 'ok';
 }
开发者ID:loder,项目名称:asf,代码行数:30,代码来源:index_controller.php

示例2: __construct

 public function __construct($config)
 {
     $this->config = $config;
     //var_dump($this->config);
     $this->dispatcher = FastRoute\simpleDispatcher(function (FastRoute\RouteCollector $r) {
         foreach ($this->config['auths'] as $id => $route) {
             log::prn_log(DEBUG, 'addRoute: ' . json_encode($route));
             $r->addRoute($route[0], $route[1], 'func_' . $id);
             $this->config['auths'][$id]['users'] = [];
             $users = explode(',', $route[2]);
             foreach ($users as $user) {
                 if (substr($user, 0, 1) != '@') {
                     if (!in_array($user, $this->config['auths'][$id]['users'])) {
                         $this->config['auths'][$id]['users'][] = $user;
                     }
                 } else {
                     $users2 = explode(',', $this->config['groups'][substr($user, 1)]);
                     foreach ($users2 as $user) {
                         if (!in_array($user, $this->config['auths'][$id]['users'])) {
                             $this->config['auths'][$id]['users'][] = $user;
                         }
                     }
                 }
             }
             if (in_array('*', $this->config['auths'][$id]['users'])) {
                 unset($this->config['auths'][$id]['users']);
                 $this->config['auths'][$id]['users'][0] = '*';
             }
         }
     });
 }
开发者ID:xtjsxtj,项目名称:esp,代码行数:31,代码来源:route.php

示例3: handel_route

 public function handel_route($method, $uri)
 {
     $route_info = $this->dispatcher->dispatch($method, $uri);
     log::prn_log(DEBUG, json_encode($route_info));
     switch ($route_info[0]) {
         case FastRoute\Dispatcher::NOT_FOUND:
             return 404;
             break;
         case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
             $allow_methods = $route_info[1];
             return 405;
             break;
         case FastRoute\Dispatcher::FOUND:
             $handler = $route_info[1][1];
             if (substr($handler, 0, 9) === '_handler.') {
                 return call_user_func(array($this, substr($handler, 9)), $route_info);
             } else {
                 list($ret['class'], $ret['fun']) = explode('.', $handler);
                 $ret['param'] = $route_info[2];
                 return $ret;
             }
             break;
     }
 }
开发者ID:loder,项目名称:asf,代码行数:24,代码来源:route.php

示例4: spl_autoload_register

<?php

/**
 * @author jiaofuyou@qq.com
 * @date   2015-10-25
 */
require_once __DIR__ . '/swoole.php';
require_once __DIR__ . '/log.php';
require_once __DIR__ . '/mysql.php';
require_once __DIR__ . '/controller.php';
require_once __DIR__ . '/protocol.php';
require_once __DIR__ . '/route.php';
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/fast-route/vendor/autoload.php';
spl_autoload_register(function ($className) {
    $file = BASE_PATH . '/controller' . "/{$className}.php";
    if (file_exists($file)) {
        log::prn_log(DEBUG, 'require_once: ' . $file);
        require_once BASE_PATH . '/controller' . "/{$className}.php";
    }
    $file = BASE_PATH . '/protocol' . "/{$className}.php";
    if (file_exists($file)) {
        log::prn_log(DEBUG, 'require_once: ' . $file);
        require_once BASE_PATH . '/protocol' . "/{$className}.php";
    }
    $file = BASE_PATH . '/config' . "/{$className}.php";
    if (file_exists($file)) {
        log::prn_log(DEBUG, 'require_once: ' . $file);
        require_once BASE_PATH . '/config' . "/{$className}.php";
    }
});
开发者ID:loder,项目名称:asf,代码行数:31,代码来源:autoload.php

示例5: start

 public function start()
 {
     // 只能单例运行
     if ($this->config['is_sington'] == true) {
         $this->checkPidfile();
     }
     $this->createPidfile();
     if (!isset($this->on_func['request'])) {
         log::prn_log(ERROR, "must set on_request callback function!");
         exit;
     }
     $this->serv->start();
     if (!$this->shutdown) {
         log::prn_log(ERROR, "swoole start error: " . swoole_errno() . ',' . swoole_strerror(swoole_errno()));
     }
 }
开发者ID:xtjsxtj,项目名称:esp,代码行数:16,代码来源:swoole.php

示例6: handle_request

 public function handle_request($serv, $request, $response)
 {
     global $worker_conf;
     global $route;
     //var_dump($request);
     $method = $request->server['request_method'];
     $uri = $request->server['request_uri'];
     $header = $request->header;
     $content = $request->rawContent();
     Log::prn_log(INFO, "REQUEST {$method} {$uri} {$content}");
     if (in_array($request->server['remote_addr'], $worker_conf['trust_ip'])) {
         log::prn_log(INFO, "trust ip: {$request->server['remote_addr']}");
         return $this->http_pass($serv, $request, $response);
     }
     $route_info = $route->handel_route($method, $uri);
     if ($route_info === 405) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 405, 'Method Not Allowed, ' . $request->server['request_method']);
     }
     if ($route_info === 404) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 404, "{$uri} is not found!");
     }
     $auth_users = $route_info;
     if (in_array('*', $auth_users)) {
         log::prn_log(INFO, "pass user: *");
         return $this->http_pass($serv, $request, $response);
     }
     if (!isset($header['authorization'])) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 401, 'Unauthorized', ['WWW-Authenticate' => 'Basic realm=Elasticsearch Auth']);
     }
     if (substr($header['authorization'], 0, 6) != 'Basic ') {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 401, 'Unauthorized, only support Basic auth');
     }
     $authorization = base64_decode(substr($header['authorization'], 6));
     list($user, $passwd) = explode(':', $authorization, 2);
     if (!in_array($user, $auth_users)) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 401, "Unauthorized, invalid user");
     }
     if (!isset($worker_conf['users'][$user])) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 401, "Unauthorized, user is not found");
     }
     if ($worker_conf['users'][$user] != $passwd) {
         Log::prn_log(NOTICE, "REQUEST {$method} {$uri} {$content}");
         return $this->response($response, 401, "Unauthorized, user passwd error!");
     }
     log::prn_log(INFO, "Basic auth pass");
     return $this->http_pass($serv, $request, $response);
 }
开发者ID:xtjsxtj,项目名称:esp,代码行数:53,代码来源:request.php

示例7: start

 public function start()
 {
     // 只能单例运行
     if ($this->config['is_sington'] == true) {
         $this->checkPidfile();
     }
     $this->createPidfile();
     $this->serv->start();
     if (!$this->shutdown) {
         log::prn_log(ERROR, "swoole start error: " . swoole_errno() . ',' . swoole_strerror(swoole_errno()));
     }
 }
开发者ID:loder,项目名称:asf,代码行数:12,代码来源:swoole.php


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