Cml\Log::notice PHP Метод

notice() публичный статический Метод

添加notice类型的日志
public static notice ( string $log, array $context = [] ) : boolean
$log string 要记录到log的信息
$context array 上下文信息
Результат boolean
    public static function notice($log, array $context = [])
    {
        return self::getLogger()->notice($log, $context);
    }

Usage Example

Пример #1
0
 /**
  * 执行预处理语句
  *
  * @param object $stmt PDOStatement
  * @param bool $clearBindParams
  *
  * @return bool
  */
 public function execute($stmt, $clearBindParams = true)
 {
     //empty($param) && $param = $this->bindParams;
     $this->conf['log_slow_sql'] && ($startQueryTimeStamp = microtime(true));
     if (!$stmt->execute()) {
         $error = $stmt->errorInfo();
         throw new \InvalidArgumentException('Pdo execute Sql error!,【Sql : ' . $this->buildDebugSql() . '】,【Error:' . $error[2] . '】');
     }
     $slow = 0;
     if ($this->conf['log_slow_sql']) {
         $queryTime = microtime(true) - $startQueryTimeStamp;
         if ($queryTime > $this->conf['log_slow_sql']) {
             if (Plugin::hook('cml.mysql_query_slow', ['sql' => $this->buildDebugSql(), 'query_time' => $queryTime]) !== false) {
                 Log::notice('slow_sql', ['sql' => $this->buildDebugSql(), 'query_time' => $queryTime]);
             }
             $slow = $queryTime;
         }
     }
     if (Cml::$debug) {
         $this->debugLogSql($slow > 0 ? Debug::SQL_TYPE_SLOW : Debug::SQL_TYPE_NORMAL, $slow);
     }
     $this->currentSql = '';
     $clearBindParams && $this->clearBindParams();
     return true;
 }