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


PHP Log::err方法代码示例

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


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

示例1: ast_node_type

function ast_node_type($node, $namespace)
{
    if ($node instanceof \ast\Node) {
        switch ($node->kind) {
            case \ast\AST_NAME:
                if ($node->flags & \ast\flags\NAME_NOT_FQ) {
                    $result = $namespace . $node->children[0];
                } else {
                    $result = $node->children[0];
                }
                break;
            case \ast\AST_TYPE:
                if ($node->flags == \ast\flags\TYPE_CALLABLE) {
                    $result = 'callable';
                } else {
                    if ($node->flags == \ast\flags\TYPE_ARRAY) {
                        $result = 'array';
                    } else {
                        assert(false, "Unknown type: {$node->flags}");
                    }
                }
                break;
            default:
                Log::err(Log::EFATAL, "ast_node_type: unknown node type: " . \ast\get_kind_name($node->kind));
                break;
        }
    } else {
        $result = (string) $node;
    }
    return $result;
}
开发者ID:bateller,项目名称:phan,代码行数:31,代码来源:ast_util.php

示例2: create

 public static function create($decoder)
 {
     if (!isset(self::$sDecoders[$decoder])) {
         throw new Exception(Log::err("Unknown decoder '{$decoder}'"));
     }
     $decoderClass = self::$sDecoders[$decoder];
     return new $decoderClass();
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:8,代码来源:MatchesDecoder.class.php

示例3: create

 public static function create($type, $properties)
 {
     if (!isset(self::$sTypes[$type])) {
         throw new Exception(Log::err("Unknown user db type '{$type}'"));
     }
     $userdbClass = self::$sTypes[$type];
     return new $userdbClass($properties);
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:8,代码来源:Userdb.class.php

示例4: __construct

 public function __construct($file)
 {
     parent::__construct($file, FileDecoder::DECODER_DIRECT);
     $this->tResource = fopen($file, "r");
     if ($this->tResource === false) {
         throw new Exception(Log::err("Cannot open file '{$file}' for reading"));
     }
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:8,代码来源:FileDecoderDirect.class.php

示例5: __construct

 public function __construct($file)
 {
     parent::__construct($file, FileDecoder::DECODER_BZIP2);
     if (!extension_loaded("bz2")) {
         throw new Exception(Log::err("Missing extension 'bz2' for bzip2 decoding"));
     }
     $this->tResource = bzopen($file, "r");
     if ($this->tResource === false) {
         throw new Exception(Log::err("Cannot open file '{$file}' for reading"));
     }
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:11,代码来源:FileDecoderBzip2.class.php

示例6: extensions

 public static function extensions($names)
 {
     $missing = array();
     foreach ($names as $name) {
         if (!extension_loaded($name)) {
             $missing[] = $name;
         }
     }
     if (count($missing) > 0) {
         throw new Exception(Log::err(sprintf("Missing required extension(s): %s", Strings::format($missing))));
     }
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:12,代码来源:CheckConfig.class.php

示例7: renderLogin

 public function renderLogin()
 {
     if (!empty($this->context->params['user_login']) && !empty($this->context->params['user_pwd'])) {
         try {
             $authentResult = $this->get('auth')->login($this->context->params['user_login'], $this->context->params['user_pwd']);
             if ($authentResult) {
                 $this->redirect('user');
             }
         } catch (Exception $e) {
             Log::err($e->getMessage());
             $this->redirect('user', array('msg' => $e->getCode()));
         }
     }
     $this->redirect('user', array('msg' => ERR_LOGIN));
 }
开发者ID:aricci95,项目名称:metallink,代码行数:15,代码来源:AuthController.php

示例8: __construct

 protected function __construct($dbh)
 {
     $this->tDbh = $dbh;
     session_name(self::SESSION_NAME);
     if (!session_start()) {
         throw new Exception(Log::err("Cannot start session"));
     }
     if (!isset($_SESSION[self::SESSION_LANG])) {
         $_SESSION[self::SESSION_LANG] = self::getDefaultLang();
     }
     self::mergeSession(self::SESSION_LANG);
     $this->tL12n = L12n::match($this->getSessionLang());
     if (!isset($_SESSION[self::SESSION_MOBILE])) {
         $_SESSION[self::SESSION_MOBILE] = self::getDefaultMobile();
     }
     self::mergeSession(self::SESSION_MOBILE);
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:17,代码来源:WebAccess.class.php

示例9: exceptionHandler

 /**
  * Handler for uncatched exceptions.
  *
  * @param Exception $exception
  */
 public static function exceptionHandler($exception)
 {
     error_log("Unhandled exception: Code {$exception->getCode()}; Message: {$exception->getMessage()}");
     if (class_exists('Log') && !is_null(Log::getLogger())) {
         Log::err(sprintf('Lpf_ExceptionHandler: Unhandled exception [%s] `%s`', $exception->getCode(), $exception->getMessage()));
     }
     if (Config::DEBUG_MODE) {
         echo "[Debug mode] Unhandled exception: Code {$exception->getCode()}; Message: {$exception->getMessage()}\r\n";
         echo $exception->getTraceAsString();
         exit;
     } else {
         if ($exception->getCode() == 404) {
             header("HTTP/1.0 404 Not Found", true, 404);
             die('<h1 style="text-align:center;">Error 404: Page Not Found</h1>');
         } else {
             header("HTTP/1.0 500 Internal Server Error", true, 500);
             die('<h1 style="text-align:center;">Error 500: Internal Server Error</h1>');
         }
     }
 }
开发者ID:lknight,项目名称:habrometr,代码行数:25,代码来源:ErrorHandler.php

示例10: sendError

 public function sendError($exception)
 {
     $errorName = 'Erreur inconnue';
     $errorType = array(E_ERROR => 'Fatal error', E_WARNING => 'Warning', E_PARSE => 'Parse error', E_NOTICE => 'Notice', ERROR_SQL => 'SQL', ERROR_BEHAVIOR => 'Behavior');
     if (!empty($errorType[$exception->getCode()])) {
         $errorName = $errorType[$exception->getCode()];
     }
     $sessionDatas = "<br/><br/>Valeurs de session : <br/>";
     if ($this->context->get('user_id')) {
         $sessionDatas .= 'user_id => ' . $this->context->get('user_id') . '<br/>';
     }
     if ($this->context->get('user_login')) {
         $sessionDatas .= 'user_login => ' . $this->context->get('user_login') . '<br/>';
     }
     if ($this->context->get('user_valid')) {
         $sessionDatas .= 'user_valid => ' . $this->context->get('user_valid') . '<br/>';
     }
     $message = nl2br('<b>Erreur ' . $errorName . ' :</b>' . '<br/><br/>' . $exception->getMessage() . '<br/><br/>' . $sessionDatas . '<br/><br/>Stack :<br/>' . $exception->getTraceAsString());
     Log::err(str_replace(array('<br/>', '<b>', '</b>', '<br />'), array("\n", '', '', ''), $message));
     return $this->send(ADMIN_MAIL, 'Erreur sur MetalLink !', $message, false);
 }
开发者ID:aricci95,项目名称:metallink,代码行数:21,代码来源:MailerService.php

示例11: setUp

 public static function setUp($logSettings)
 {
     Log::$err = $logSettings['errors'];
     Log::$warn = $logSettings['warnings'];
     Log::$all = $logSettings['all'];
     Log::$debug = $logSettings['debug'];
     Log::$req = $logSettings['requests'];
     //removing old files
     if (file_exists(Log::$err)) {
         unlink(Log::$err);
     }
     if (file_exists(Log::$warn)) {
         unlink(Log::$warn);
     }
     if (file_exists(Log::$all)) {
         unlink(Log::$all);
     }
     if (file_exists(Log::$debug)) {
         unlink(Log::$debug);
     }
     if (file_exists(Log::$req)) {
         unlink(Log::$req);
     }
 }
开发者ID:GrapheneProject,项目名称:Graphene,代码行数:24,代码来源:utils.php

示例12: __invoke

 /**
  * @return void
  */
 public function __invoke()
 {
     Log::err($this->getIssue()->getCategory(), $this->getIssue()->getType(), $this->getIssue()->getSeverity(), call_user_func_array('sprintf', array_merge([$this->getIssue()->getTemplate()], $this->getTemplateParameters())), $this->getFile(), $this->getLine());
 }
开发者ID:actank,项目名称:phan,代码行数:7,代码来源:IssueInstance.php

示例13: node_type

function node_type($file, $namespace, $node, $current_scope, $current_class, &$taint = null, $check_var_exists = true)
{
    global $classes, $functions, $scope, $namespace_map, $internal_arginfo;
    if (!$node instanceof \ast\Node) {
        if ($node === null) {
            return '';
        }
        return type_map(gettype($node));
    } else {
        if ($node->kind == \ast\AST_ARRAY) {
            return 'array';
        } else {
            if ($node->kind == \ast\AST_BINARY_OP) {
                $taint = var_taint_check($file, $node, $current_scope);
                switch ($node->flags) {
                    // Always a string from a concat
                    case \ast\flags\BINARY_CONCAT:
                        $temp_taint = false;
                        node_type($file, $namespace, $node->children[0], $current_scope, $current_class, $temp_taint);
                        if ($temp_taint) {
                            $taint = true;
                            return 'string';
                        }
                        node_type($file, $namespace, $node->children[1], $current_scope, $current_class, $temp_taint);
                        if ($temp_taint) {
                            $taint = true;
                        }
                        return 'string';
                        break;
                        // Boolean unless invalid operands
                    // Boolean unless invalid operands
                    case \ast\flags\BINARY_IS_IDENTICAL:
                    case \ast\flags\BINARY_IS_NOT_IDENTICAL:
                    case \ast\flags\BINARY_IS_EQUAL:
                    case \ast\flags\BINARY_IS_NOT_EQUAL:
                    case \ast\flags\BINARY_IS_SMALLER:
                    case \ast\flags\BINARY_IS_SMALLER_OR_EQUAL:
                        $taint = false;
                        return 'bool';
                        break;
                        // Add is special because you can add arrays
                    // Add is special because you can add arrays
                    case \ast\flags\BINARY_ADD:
                        $temp = node_type($file, $namespace, $node->children[0], $current_scope, $current_class);
                        if (!$temp) {
                            $left = '';
                        } else {
                            $left = type_map($temp);
                        }
                        $temp = node_type($file, $namespace, $node->children[1], $current_scope, $current_class);
                        if (!$temp) {
                            $right = '';
                        } else {
                            $right = type_map($temp);
                        }
                        if ($left == 'array' && $right == 'array') {
                            return 'array';
                        } else {
                            if ($left == 'array' && !type_check($right, 'array')) {
                                Log::err(Log::ETYPE, "invalid operator: left operand is array and right is not", $file, $node->lineno);
                                return '';
                            } else {
                                if ($right == 'array' && !type_check($left, 'array')) {
                                    Log::err(Log::ETYPE, "invalid operator: right operand is array and left is not", $file, $node->lineno);
                                    return '';
                                } else {
                                    if ($left == 'int' && $right == 'int') {
                                        return 'int';
                                    } else {
                                        if ($left == 'float' || $right == 'float') {
                                            return 'float';
                                        } else {
                                            if ($left == 'array' || $right == 'array') {
                                                // If it is a '+' and we know one side is an array and the other is unknown, assume array
                                                return 'array';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        return 'int|float';
                        $taint = false;
                        break;
                        // Everything else should be an int/float
                    // Everything else should be an int/float
                    default:
                        $temp = node_type($file, $namespace, $node->children[0], $current_scope, $current_class);
                        if (!$temp) {
                            $left = '';
                        } else {
                            $left = type_map($temp);
                        }
                        $temp = node_type($file, $namespace, $node->children[1], $current_scope, $current_class);
                        if (!$temp) {
                            $right = '';
                        } else {
                            $right = type_map($temp);
                        }
                        if ($left == 'array' || $right == 'array') {
//.........这里部分代码省略.........
开发者ID:nguyentamvinhlong,项目名称:phan,代码行数:101,代码来源:pass2.php

示例14: node_func

function node_func($file, $conditional, $node, $current_scope, $current_class, $namespace = '')
{
    global $scope;
    if ($node instanceof \ast\Node) {
        $req = $opt = 0;
        $dc = ['return' => '', 'params' => []];
        if (!empty($node->docComment)) {
            $dc = parse_doc_comment($node->docComment);
        }
        $result = ['file' => $file, 'namespace' => $namespace, 'scope' => $current_scope, 'conditional' => $conditional, 'flags' => $node->flags, 'lineno' => $node->lineno, 'endLineno' => $node->endLineno, 'name' => strpos($current_scope, '::') === false ? $namespace . $node->name : $node->name, 'docComment' => $node->docComment, 'params' => node_paramlist($file, $node->children[0], $req, $opt, $dc, $namespace), 'required' => $req, 'optional' => $opt, 'ret' => '', 'oret' => '', 'ast' => $node->children[2]];
        if ($node->children[3] !== null) {
            $result['oret'] = ast_node_type($file, $node->children[3], $namespace);
            // Original return type
            $result['ret'] = ast_node_type($file, $node->children[3], $namespace);
            // This one changes as we walk the tree
        } else {
            // Check if the docComment has a return value specified
            if (!empty($dc['return'])) {
                if ($dc['return'] == 'static' || $dc['return'] == 'self' || $dc['return'] == '$this') {
                    if (strpos($current_scope, '::') !== false) {
                        list($dc['return'], ) = explode('::', $current_scope);
                    }
                }
                $result['oret'] = $dc['return'];
                $result['ret'] = $dc['return'];
            }
        }
        // Add params to local scope for user functions
        if ($file != 'internal') {
            $i = 1;
            foreach ($result['params'] as $k => $v) {
                if (empty($v['type'])) {
                    // If there is no type specified in PHP, check for a docComment
                    // We assume order in the docComment matches the parameter order in the code
                    if (!empty($dc['params'][$k]['type'])) {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => $dc['params'][$k]['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    } else {
                        $scope[$current_scope]['vars'][$v['name']] = ['type' => '', 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                    }
                } else {
                    $scope[$current_scope]['vars'][$v['name']] = ['type' => $v['type'], 'tainted' => false, 'tainted_by' => '', 'param' => $i];
                }
                if (array_key_exists('def', $v)) {
                    $type = node_type($file, $namespace, $v['def'], $current_scope, $current_class);
                    if ($type === "NULL") {
                        add_type($current_scope, $v['name'], $type);
                        if (!empty($result['params'][$k]['type'])) {
                            $result['params'][$k]['type'] .= '|NULL';
                        }
                    } else {
                        if ($scope[$current_scope]['vars'][$v['name']]['type'] !== '') {
                            // Does the default value match the declared type?
                            if (!type_check($type, $scope[$current_scope]['vars'][$v['name']]['type'])) {
                                Log::err(Log::ETYPE, "Default value for {$scope[$current_scope]['vars'][$v['name']]['type']} \${$v['name']} can't be {$type}", $file, $node->lineno);
                            }
                        }
                    }
                }
                $i++;
            }
        }
        return $result;
    }
    assert(false, "{$node} was not an \\ast\\Node");
}
开发者ID:nguyentamvinhlong,项目名称:phan,代码行数:65,代码来源:pass1.php

示例15: renderSubmit

 public function renderSubmit()
 {
     if (!empty($this->context->params['last_content']) && !empty($this->context->params['content']) && $this->context->params['last_content'] === $this->context->params['content']) {
         $this->render();
         return;
     }
     if (empty($this->context->params['destinataire_id'])) {
         Log::err('destinataire vide');
         $this->redirect('mailbox', array('msg' => ERR_DEFAULT));
     }
     $isLinked = $this->get('link')->isLinked($this->context->params['destinataire_id']);
     if (!$isLinked) {
         Log::err('destinataire sans link');
         $this->redirect('mailbox', array('msg' => ERR_DEFAULT));
     }
     $from = $this->context->get('user_id');
     $to = $this->context->params['destinataire_id'];
     if (empty($this->context->params['content'])) {
         $this->view->growler('Message vide.', GROWLER_INFO);
         $this->render();
         return;
     }
     if ($this->get('message')->send($from, $to, $this->context->params['content'])) {
         $message = $this->context->get('user_login') . ' vous a envoyé un nouveau message ! <a href="http://metallink.fr/message/' . $this->context->get('user_id') . '">Cliquez ici</a> pour le lire.';
         $this->redirect('message', array($this->context->params['value'], 'msg' => MSG_SENT_OK));
     } else {
         Log::err('impossible d\'enregistrer le message.');
         $this->redirect('mailbox', array('msg' => ERR_MAIL));
     }
     return;
 }
开发者ID:aricci95,项目名称:metallink,代码行数:31,代码来源:MessageController.php


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