本文整理汇总了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;
}
}
示例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]);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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']);
}
}
}
示例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.');
}
示例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);
}
示例14: log_error
function log_error($str)
{
log::error($str);
}
示例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;
}