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


PHP log::error方法代码示例

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


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

示例1: debug

 /**
  * debug a message. Writes to stdout and to log file 
  * if debug = 1 is set in config
  * @param string $message 
  */
 public static function debug($message)
 {
     if (config::getMainIni('debug')) {
         log::error($message);
         return;
     }
 }
开发者ID:remyoucef,项目名称:noiphp,代码行数:12,代码来源:log.php

示例2: postOrder

 public function postOrder()
 {
     log::debug('postOrder::Input params');
     log::debug(Input::all());
     //Validation rules
     $rules = array('pizza_marinara' => array('required', 'integer', 'between:0,3'), 'pizza_margherita' => array('required', 'integer', 'between:0,3'), 'olio' => array('min:1|max:20'), 'name' => array('required', 'min:1|max:20'), 'email' => array('required', 'email', 'min:1|max:20'), 'freeOrder' => array('exists:menu,dish'));
     // The validator
     $validation = Validator::make(Input::all(), $rules);
     // Check for fails
     if ($validation->fails()) {
         // Validation has failed.
         log::error('Validation has failed');
         $messages = $validation->messages();
         $returnedMsg = "";
         foreach ($messages->all() as $message) {
             $returnedMsg = $returnedMsg . " - " . $message;
         }
         log::error('Validation fail reason: ' . $returnedMsg);
         return redirect()->back()->withErrors($validation);
     }
     log::debug('Validation passed');
     $msg = array('email' => Input::get('email'), 'name' => Input::get('name'));
     $response = Event::fire(new ExampleEvent($msg));
     $response = Event::fire(new OrderCreated($msg));
     return view('orderdone', ['msg' => $msg]);
 }
开发者ID:WebYourMind,项目名称:courses-laravel5,代码行数:26,代码来源:NewOrderController.php

示例3: exceptionHandler

/**
 * @param \Exception $e
 * @return bool
 */
function exceptionHandler(\Exception $e)
{
    echo '<h1>Error</h1><p>Sorry, the script died with a exception</p>';
    echo $e->getMessage() . ' in <br>' . $e->getFile() . ': <br>' . $e->getLine(), ' : <br>', __FUNCTION__, ' : <br>', $e->getTraceAsString();
    log::error($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine() . "<br>\n", "Code: " . $e->getCode(), $e->getTrace());
    mail(ADMIN_MAIL, '[GitReminder] System got locked', $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine() . "\n\n" . "Funktion -> " . __FUNCTION__ . $e->getTraceAsString() . "\n\n" . "Code: " . $e->getCode());
    @trigger_error('', E_USER_ERROR);
}
开发者ID:ADoebeling,项目名称:GitReminder,代码行数:12,代码来源:bootstrap.php

示例4: vqueryf

 public static function vqueryf($conn, $sql, $args = array())
 {
     $sql = self::generate_sql($conn, $sql, $args);
     if (self::$log > 0) {
         self::$log--;
         log::debug($sql);
     }
     $result = mysql_query($sql, $conn);
     if ($error = mysql_error()) {
         log::error($error);
         return false;
     }
     return $result;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:14,代码来源:database.php

示例5: getSSHSession

 /**
  * Gets the SSH session using the auth given
  *
  * @param \App\Models\Auth $auth Auth model
  * @param \Ssh\Configuration $configuration SSH configuration object
  */
 protected function getSSHSession($auth, $host)
 {
     $session = new SSH2($host);
     if ($auth->isKeyAuthentication()) {
         $key = new RSA();
         $key->loadKey($auth->credentials->key);
         if (!$session->login($auth->credentials->username, $key)) {
             \log::error('Login Failed');
         }
     } else {
         if (!$session->login($auth->credentials->username, $auth->credentials->password)) {
             \log::error('Login Failed');
         }
     }
     return $session;
 }
开发者ID:continuous-deployment,项目名称:pipes,代码行数:22,代码来源:SSHExecutor.php

示例6: __autoload

/**
 * 自动加载类库处理
 * @return void
 */
function __autoload($classname)
{
    $classname = preg_replace("/[^0-9a-z_]/i", '', $classname);
    if (class_exists($classname)) {
        return true;
    }
    $classfile = $classname . '.php';
    try {
        if (file_exists(PATH_LIBRARY . '/' . $classfile)) {
            require PATH_LIBRARY . '/' . $classfile;
        } else {
            throw new Exception('Error: Cannot find the ' . $classname);
        }
    } catch (Exception $e) {
        log::error($e->getMessage() . '|' . $classname);
        exit;
    }
}
开发者ID:jackyxie,项目名称:phpspider,代码行数:22,代码来源:init.php

示例7: item_created

 static function item_created($item)
 {
     access::add_item($item);
     if ($item->is_photo() || $item->is_movie()) {
         // Build our thumbnail/resizes.
         try {
             graphics::generate($item);
         } catch (Exception $e) {
             log::error("graphics", t("Couldn't create a thumbnail or resize for %item_title", array("item_title" => $item->title)), html::anchor($item->abs_url(), t("details")));
             Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
         }
         // If the parent has no cover item, make this it.
         $parent = $item->parent();
         if (access::can("edit", $parent) && $parent->album_cover_item_id == null) {
             item::make_album_cover($item);
         }
     }
 }
开发者ID:andyst,项目名称:gallery3,代码行数:18,代码来源:gallery_event.php

示例8: run_query

 protected function run_query($sql, array $params = null)
 {
     $stmt = false;
     try {
         $stmt = $this->db->prepare($sql);
     } catch (PDOException $e) {
         log::error('Error preparing query on database: ' . $this->connectDetails['db'] . ' ' . $e->getMessage());
     }
     if (!$stmt) {
         return false;
     }
     if (!call_user_func(array($stmt, 'execute'), $params)) {
         $this->last_error = $stmt->errorInfo();
         log::$errorDetails = $this->last_error();
         log::error('Query executiong failed: ' . $this->last_error[2]);
     }
     return $stmt;
 }
开发者ID:Borvik,项目名称:Munla,代码行数:18,代码来源:mysql.php

示例9: create

 /**
  * Create new entity with parameters
  */
 public static function create(array $params = array())
 {
     $class = get_called_class();
     $model = \lib\conf\models::${$class::$database}[$class::$table];
     $params['date_added'] = $params['date_updated'] = 'UNIX_TIMESTAMP()';
     $keys = array_keys($params);
     // check primary key possibilities
     if ($model['primary_key']['auto_increment']) {
         // primary key cannot be set if it is auto_increment
         if (!empty($params[$model['primary_key']['field']])) {
             log::error('cannot create with auto_increment key filled in: table: ' . $class::$table . ' field: ' . $model['primary_key']['field']);
             return false;
         }
     } else {
         // primary key must be filled in if not auto_increment
         if (empty($params[$model['primary_key']['field']])) {
             log::error('primary key unspecified: table: ' . $class::$table . ' field: ' . $model['primary_key']['field']);
             return false;
         }
     }
     $placeholders = $values = array();
     foreach ($keys as $key) {
         // if primary is auto_increment, then skip it
         if ($model['primary_key']['auto_increment'] && $model['primary_key']['field'] == $key) {
             continue;
         }
         if (!isset($model['fields'][$key])) {
             continue;
         }
         $column_list[] = $key;
         $placeholders[] = $model['fields'][$key];
         $values[] = $params[$key];
     }
     $column_list = '(`' . implode('`, `', $column_list) . '`)';
     $placeholders = '(' . implode(', ', $placeholders) . ')';
     $conn = self::get_database();
     database::vqueryf($conn, "INSERT INTO `{$class::$table}` {$column_list} VALUES {$placeholders}", $values);
     if ($model['primary_key']['auto_increment']) {
         $primary_key = mysql_insert_id($conn);
     } else {
         $primary_key = $params[$model['primary_key']['field']];
     }
     return $primary_key;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:47,代码来源:entity.php

示例10: register

 /**
  * Registers a new injector
  * 
  * @param callable $function The function to register as an injector.
  * 
  * @return void
  */
 public static function register(callable $function)
 {
     $target = null;
     $method = null;
     if (is_string($function)) {
         if (strpos($function, '::') === false) {
             $method = $function;
         } else {
             $parts = explode('::', $function);
             $target = $parts[0];
             $method = $parts[1];
         }
     } elseif (is_array($function)) {
         $target = $function[0];
         $method = $function[1];
     }
     $has = false;
     $put = null;
     if (is_null($target) && !is_null($method)) {
         $put = $method;
         $has = in_array($method, self::$injectors);
     } elseif (!is_null($target) && !is_null($method)) {
         if (is_string($target)) {
             $put = sprintf('%s::%s', $target, $method);
             $has = in_array($put, self::$injectors);
         } else {
             $put = $function;
             foreach (self::$injectors as $v) {
                 if (is_array($v) && $v[0] == $put[0] && $v[1] == $put[1]) {
                     $has = true;
                     break;
                 }
             }
         }
     }
     if ($has) {
         log::notice('Method has already been registered as an injector.');
     }
     if (is_null($put)) {
         log::error('Error validating callback function registered status.');
     }
     self::$injectors[] = $put;
 }
开发者ID:Borvik,项目名称:Munla,代码行数:50,代码来源:injector.php

示例11: init

 protected function init(array $details)
 {
     if (!isset($this->db)) {
         $required_fields = array('server', 'port', 'path');
         foreach ($required_fields as $v) {
             if (!array_key_exists($v, $details)) {
                 log::error('Unable to connect to Solr database - missing required fields.');
             }
         }
         try {
             $this->db = sprintf('http%s://%s:%s%s', isset($details['secure']) && $details['secure'] ? 's' : '', $details['server'], $details['port'], $details['path']);
             @$this->ping();
             $this->connectDetails = $details;
         } catch (Exception $e) {
             $this->db = null;
             log:
             error('Unable to connect to solr database on ' . $details['server']);
         }
     }
 }
开发者ID:Borvik,项目名称:Munla,代码行数:20,代码来源:solr.php

示例12: static_callable

 /**
  * Returns a string for a class static callable method, with the class modified.
  * 
  * @param callable $callback    The callback method to modify and return.
  * @param string $appendToClass The string to append to the class for the new class name.
  * 
  * @return callable A callable string in the format class::function.
  */
 private static function static_callable($callback, $appendToClass = '')
 {
     if (is_string($callback)) {
         $parts = explode('::', $callback);
         return sprintf('%s%s::%s', $parts[0], $appendToClass, $parts[1]);
     } elseif (is_array($callback)) {
         return sprintf('%s%s::%s', $callback[0], $appendToClass, $callback[1]);
     }
     log::error('Invalid callback specified, unable to return static method string.');
 }
开发者ID:Borvik,项目名称:Munla,代码行数:18,代码来源:get.php

示例13: raw_query

 /**
  * Performs a given query.
  * 
  * Used by other query methods, and also usefully for non-select queries.
  * 
  * @param string $sql The query to run.
  * @param mixed $params Could be an array of scalar values for a parameterized query, or for some database types an array of additional options.  May also be scalar values for a parameterized query.
  * 
  * @return mixed The query result.  Type differs based on database type.
  */
 public function raw_query($sql, $params = array())
 {
     if (!isset($this->db)) {
         if (error_reporting() !== 0) {
             log::error('Error running database query. Database connection not initialized.');
         }
         return false;
     }
     $args = func_get_args();
     if (count($args) > 1 && !is_array($params)) {
         array_shift($args);
         $params = $args;
     }
     return $this->run_query($sql, $params);
 }
开发者ID:Borvik,项目名称:Munla,代码行数:25,代码来源:db.php

示例14: log_error

function log_error($str)
{
    log::error($str);
}
开发者ID:samplecms,项目名称:package,代码行数:4,代码来源:_function.php

示例15: sp

 public function sp($sql, array &$params, $options = array())
 {
     if (!isset($this->db)) {
         if (error_reporting() !== 0) {
             log::error('Error running database query. Database connection not initialized.');
         }
         return false;
     }
     if (isset($options) && !is_array($options)) {
         $options = array();
     }
     $result = sqlsrv_query($this->db, $sql, $params, $options);
     if ($result === false && error_reporting() !== 0) {
         log::$errorDetails = $this->last_error();
         log::error('Error running query on database: ' . $this->connectDetails['db']);
     }
     if ($result !== false) {
         sqlsrv_next_result($result);
     }
     return $result;
 }
开发者ID:Borvik,项目名称:Munla,代码行数:21,代码来源:mssql.php


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