本文整理汇总了PHP中Illuminate\Support\Facades\Log::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::error方法的具体用法?PHP Log::error怎么用?PHP Log::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Log
的用法示例。
在下文中一共展示了Log::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: push
public function push($token, $data, $params)
{
try {
$url = 'https://' . $this->config['host'];
$fields = array('registration_ids' => array($token), 'data' => array_merge($data, ['data' => $params]));
$headers = array('Authorization: key=' . $this->config['key'], 'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
Log::error('Curl failed: ' . curl_error($ch));
return false;
}
// Close connection
curl_close($ch);
return true;
} catch (Exception $e) {
Log::error($e);
return false;
}
}
示例2: getOrder
/**
* Listens for and stores PayPal IPN requests.
*
* @throws InvalidIpnException
*
* @return IpnOrder
*/
public function getOrder()
{
$ipnMessage = null;
$listenerBuilder = new ListenerBuilder();
if ($this->getEnvironment() == 'sandbox') {
$listenerBuilder->useSandbox();
// use PayPal sandbox
}
$listener = $listenerBuilder->build();
$listener->onVerified(function (MessageVerifiedEvent $event) {
$ipnMessage = $event->getMessage();
Log::info('IPN message verified - ' . $ipnMessage);
$this->order = $this->store($ipnMessage);
});
$listener->onInvalid(function (MessageInvalidEvent $event) {
$report = $event->getMessage();
Log::warning('Paypal returned invalid for ' . $report);
});
$listener->onVerificationFailure(function (MessageVerificationFailureEvent $event) {
$error = $event->getError();
// Something bad happend when trying to communicate with PayPal!
Log::error('Paypal verification error - ' . $error);
});
$listener->listen();
return $this->order;
}
示例3: create
/**
* Create a user and return response
*
* @param array $data
* @param CreatorListenerInterface $listener
* @return mixed
*/
public function create(array $data, CreatorListenerInterface $listener)
{
$valid = $this->userValidator->isValid($data);
if (!$valid) {
return $listener->onCreateFail($this->userValidator->getMessages());
}
$groups = empty($data['roles']) ? [] : $data['roles'];
$data = $this->filterData($data);
if ($this->auth->check()) {
$user = $this->auth->user();
$data['creator_id'] = $user->id;
}
try {
$data['activated'] = true;
$user = $this->userRepo->create($data);
$this->events->fire('user.created', array($user));
if (Sentry::getUser()->hasAnyAccess(['user.change_groups'])) {
$this->groupRepo->addGroupsToUser($user, $groups);
}
return $listener->onCreateSuccess();
} catch (InvalidArgumentException $e) {
Log::error($e->getMessage());
return $listener->onCreateFail([Lang::get('messages.operation_error')]);
}
}
示例4: update
/**
* Update the profile based on the form submission
* @param ProfileUpdateRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function update(ProfileUpdateRequest $request)
{
$contact = $this->getContact();
$contact->setName($request->input('name'));
$contact->setRole($request->input('role'));
$contact->setEmailAddress($request->input('email_address'));
try {
$work = $contact->getPhoneNumber(PhoneNumber::WORK);
$work->setNumber(preg_replace("/[^0-9]/", "", $request->input('work_phone')));
$contact->setPhoneNumber($work);
$mobile = $contact->getPhoneNumber(PhoneNumber::MOBILE);
$mobile->setNumber(preg_replace("/[^0-9]/", "", $request->input('mobile_phone')));
$contact->setPhoneNumber($mobile);
$home = $contact->getPhoneNumber(PhoneNumber::HOME);
$home->setNumber(preg_replace("/[^0-9]/", "", $request->input('home_phone')));
$contact->setPhoneNumber($home);
$fax = $contact->getPhoneNumber(PhoneNumber::FAX);
$fax->setNumber(preg_replace("/[^0-9]/", "", $request->input('fax')));
$contact->setPhoneNumber($fax);
} catch (Exception $e) {
return redirect()->back()->withErrors($e->getMessage());
}
$contactController = new ContactController();
try {
$contactController->updateContact($contact);
} catch (Exception $e) {
Log::error($e->getMessage());
return redirect()->back()->withErrors(trans("errors.failedToUpdateProfile"));
}
$this->clearProfileCache();
return redirect()->action("ProfileController@show")->with('success', trans("profile.profileUpdated"));
}
示例5: report
/**
* Report and log an exception.
*
* @author Morten Rugaard <moru@nodes.dk>
* @author Rasmus Ebbesen <re@nodes.dk>
*
* @param Exception $e
* @throws Exception
*/
public function report(Exception $e)
{
try {
if (class_exists('\\Nodes\\Bugsnag\\ServiceProvider')) {
if (\Nodes\Bugsnag\ServiceProvider::VERSION == '1.0') {
if ($e instanceof NodesException && $e->getReport()) {
app('nodes.bugsnag')->notifyException($e, $e->getMeta(), $e->getSeverity());
} elseif (!$e instanceof NodesException) {
app('nodes.bugsnag')->notifyException($e, null, 'error');
}
} elseif (\Nodes\Bugsnag\ServiceProvider::VERSION == '2.0') {
if ($e instanceof NodesException && $e->getReport()) {
app('nodes.bugsnag')->notifyException($e, function (\Bugsnag\Report $report) use($e) {
$report->setMetaData($e->getMeta(), true);
$report->setSeverity($e->getSeverity());
});
} elseif (!$e instanceof NodesException) {
app('nodes.bugsnag')->notifyException($e, function (\Bugsnag\Report $report) {
$report->setSeverity('error');
});
}
}
}
} catch (\Throwable $e) {
// Do nothing
}
Log::error($e);
}
示例6: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e)) {
Log::error($e);
}
parent::report($e);
}
示例7: downloadFileInWindowsNT
protected function downloadFileInWindowsNT(TFFile $file)
{
$client = new Client();
try {
$response = $client->get($file->source, ['verify' => false]);
} catch (\Exception $e) {
$error = 'TFDownloader: Downloading file failed, url is %s, msg is %s.';
$error = sprintf($error, $file->source, $e->getMessage());
Log::error($error);
$file->state = 'error';
$file->error = $error;
$file->save();
return;
}
if ($response->getStatusCode() == 200) {
$location = 'file/' . $file->name;
Storage::put($location, $response->getBody());
$file->state = 'downloaded';
$file->location = $location;
$file->save();
return;
} else {
$error = 'TFDownloader: Bad HTTP response code in downloading videos, url is %s, status code is %d.';
$error = sprintf($error, $file->source, $response->getStatusCode());
Log::error($error);
$file->state = 'error';
$file->error = $error;
$file->save();
return;
}
}
示例8: e
static function e($arg, $trace = false)
{
Log::error(print_r($arg, true));
if ($trace) {
Log::error(print_r(debug_backtrace()));
}
}
示例9: receive
/**
* 客户端接收数据
* 状态码说明 (1 交易完成 0 交易失败)
*/
public function receive($result)
{
$result = $this->filterParameter($result);
$return['status'] = 0;
if ($result) {
$return = array();
$v_oid = trim($result['v_oid']);
$v_pmode = trim($result['v_pmode']);
$v_pstatus = trim($result['v_pstatus']);
$v_pstring = trim($result['v_pstring']);
$v_amount = trim($result['v_amount']);
$v_moneytype = trim($result['v_moneytype']);
$remark1 = isset($result['remark1']) ? trim($result['remark1']) : '';
$remark2 = isset($result['remark2']) ? trim($result['remark2']) : '';
$v_md5str = trim($result['v_md5str']);
$md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $this->_config['key']));
if ($v_md5str == $md5string) {
$return['oid'] = $v_oid;
$return['data'] = $v_pmode;
$return['note'] = '支付方式:' . $v_pmode . '支付结果信息:' . $v_pstring;
if ($v_pstatus == '20') {
$return['status'] = 1;
} else {
Log::error(date('m-d H:i:s') . '| chinabank order=' . $v_oid . ' status=' . $v_pstatus);
}
} else {
Log::error(date('m-d H:i:s') . '| chinabank order=' . $v_oid . ' 非法sign');
}
} else {
Log::error(date('m-d H:i:s') . '| chinabank no return!' . "\r\n");
}
return $return;
}
示例10: saveImageLocally
/**
* @param \Onyx\Destiny\Objects\Hash $hash
* @param string $index
* @return bool
*/
public static function saveImageLocally($hash, $index = 'extra')
{
// BUG: Can't use variable object indexes implicitly
// $hash->{$index} should work but doesn't
// map the index explicitly with the attributes dumped into $bug
$bug = $hash->getAttributes();
$url = "https://bungie.net" . $bug[$index];
$name = $index != 'extra' ? '_bg' : null;
$name = $hash->hash . $name;
// Make sure we aren't trying to save something that isn't an image
// We only need this check because we cheat and store all hash related objects
// in one table. This means we have crazy cheats to get things done.
if (strlen($bug[$index]) < 5) {
return false;
}
$location = public_path('uploads/thumbs/');
$filename = $name . "." . pathinfo($bug[$index], PATHINFO_EXTENSION);
if (File::isFile($location . $filename)) {
return true;
}
if ($hash instanceof Hash) {
$manager = new ImageManager();
try {
$img = $manager->make($url);
$img->save($location . $filename);
} catch (NotReadableException $e) {
Log::error('Could not download: ' . $url);
}
return true;
}
}
示例11: getBadRequstView
public static function getBadRequstView($msg)
{
if (!empty($msg)) {
Log::error($msg);
}
return response('错误的输入,3秒后返回。' . '<script>setTimeout(function(){history.back()},3000)' . '</script>', 400);
}
示例12: sendError
public function sendError()
{
$config = config($this->confPath);
$output = '';
$file = $this->e->getFile();
$line = $this->e->getLine();
$trace = $this->e->getTrace();
try {
if (file_exists($file)) {
$f = file($file);
$line = (int) $line;
for ($i = $line - 5; $i <= $line + 5; $i++) {
if (isset($f[$i])) {
$output .= $i + 1 . ": " . $f[$i];
}
}
} else {
if (is_array($trace) && !empty($trace)) {
$elem = current($trace);
if (is_array($elem)) {
if (isset($elem['file']) && isset($elem['line'])) {
$file = file($elem['file']);
$line = (int) $elem['line'];
for ($i = $line - 5; $i <= $line + 5; $i++) {
if (isset($file[$i])) {
$output .= $i + 1 . ": " . $file[$i];
}
}
}
}
}
}
} catch (\Exception $e) {
Log::error('Email:Error:Reporting: ' . $e->getMessage());
}
try {
$request = array();
$request['fullUrl'] = request()->fullUrl();
$request['input_get'] = isset($_GET) ? $_GET : null;
$request['input_post'] = isset($_POST) ? $_POST : null;
$request['session'] = session()->all();
$request['cookie'] = request()->cookie();
$request['file'] = request()->file();
$request['header'] = request()->header();
$request['server'] = request()->server();
$request['output'] = $output;
$request['json'] = request()->json();
$request['request_format'] = request()->format();
$request['error'] = $this->e->getTraceAsString();
$request['subject_line'] = $this->e->getMessage();
$request['error_line'] = $line;
$request['error_file'] = $file;
$request['class_name'] = get_class($this->e);
$request['reported_by'] = isset($config['reported_by']) ? $config['reported_by'] : 'LaravelErrorMailer';
$data = ['tempData' => $request];
$this->exec($data);
} catch (Exception $e) {
Log::error('Email:Error:Reporting: ' . $e->getMessage());
}
}
示例13: update
public function update($data)
{
$response = new ApiResponse();
$status = 200;
$mission = Mission::find(\Request::get('id'));
if ($mission == null) {
$response->status = 'error';
$response->message = ['id' => '', 'code' => 'mission_not_found', 'description' => 'The mission was not found'];
$status = 400;
} else {
$mission = $this->sanitize($data, $mission);
try {
$this->radicalIntegrationManager->updateMission($mission);
} catch (RadicalApiException $e) {
Log::error($e);
//For now ingore, see [CIT-380]
// $response->status = 'error';
// $response->message = $e->getMessage();
// $status = 500;
}
$mission->save();
$response->status = 'success';
$response->message = $mission->id;
}
return \Response::json($response, $status);
}
示例14: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
Log::info('infoメッセージ');
Log::debug('debugメッセージ');
Log::warning('warningメッセージ');
Log::error('errorメッセージ');
return view('welcome');
}
示例15: handle
/**
* Handle the event.
*
* @param ErrorOccurredEvent $event
*
*/
public function handle(ErrorOccurredEvent $event)
{
Log::error('Event occurred: ' . $event->statusCode);
$data['statusCode'] = $event->statusCode;
$subject = $event->statusCode . ' exception occurred in ' . $this->appName . ' project';
$headers = $event->headers['user-agent'][0];
Artisan::call('emails:send', ['type' => $this->type, 'name' => $this->emailToName, 'email' => $this->emailToAddress, '--subject' => $subject, '--caption' => $event->message, '--fullUrl' => $event->fullUrl, '--headers' => $headers, '--parentClass' => $event->parentClass, '--exceptionTrace' => $event->exception]);
}