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


PHP Log::error方法代码示例

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


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

示例1: update

 /**
  * updates title and description of an activity
  * @param array    $activityDetails
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDetails, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->stepTwoRepo->update($activityDetails, $activity);
         $this->database->commit();
         $this->logger->info('Step Two Completed!', ['for' => [$activity->title, $activity->description]]);
         $this->logger->activity("activity.step_two_completed", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['stepTwo' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:StepTwoManager.php

示例2: myErrorHandler

function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    if (!class_exists('Log')) {
        require YYUC_LIB . 'sys/log.php';
    }
    $err_msg = "信息:{$errno}。内容:{$errstr},发生在文件{$errfile}的{$errline}行";
    switch ($errno) {
        case E_USER_ERROR:
            Log::error($err_msg);
            if (Conf::$is_developing) {
                echo $err_msg;
            }
            exit(1);
            break;
        case E_USER_WARNING:
            Log::warn($err_msg);
            break;
        case E_USER_NOTICE:
            Log::info($err_msg);
            break;
        default:
            Log::info($err_msg);
            break;
    }
    return true;
}
开发者ID:codingoneapp,项目名称:codingone,代码行数:26,代码来源:yyuc.php

示例3: store

 /**
  * save new activity from wizard
  * @param array $identifier
  * @param       $defaultFieldValues
  * @return bool
  */
 public function store(array $identifier, $defaultFieldValues)
 {
     try {
         $this->database->beginTransaction();
         $result = $this->activityRepo->store($identifier, $defaultFieldValues, $this->auth->user()->organization->id);
         $this->activityRepo->saveDefaultValues($result->id, $defaultFieldValues);
         $this->database->commit();
         $this->logger->info('Activity identifier added!', ['for' => $identifier['activity_identifier']]);
         $this->logger->activity("activity.activity_added", ['identifier' => $identifier['activity_identifier'], 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return $result;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['ActivityIdentifier' => $identifier]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:22,代码来源:ActivityManager.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  * @throws ImageFailedException
  * @throws \BB\Exceptions\FormValidationException
  */
 public function store()
 {
     $data = \Request::only(['user_id', 'category', 'description', 'amount', 'expense_date', 'file']);
     $this->expenseValidator->validate($data);
     if (\Input::file('file')) {
         try {
             $filePath = \Input::file('file')->getRealPath();
             $ext = \Input::file('file')->guessClientExtension();
             $mimeType = \Input::file('file')->getMimeType();
             $newFilename = \App::environment() . '/expenses/' . str_random() . '.' . $ext;
             Storage::put($newFilename, file_get_contents($filePath), 'public');
             $data['file'] = $newFilename;
         } catch (\Exception $e) {
             \Log::error($e);
             throw new ImageFailedException($e->getMessage());
         }
     }
     //Reformat from d/m/y to YYYY-MM-DD
     $data['expense_date'] = Carbon::createFromFormat('j/n/y', $data['expense_date']);
     if ($data['user_id'] != \Auth::user()->id) {
         throw new \BB\Exceptions\FormValidationException('You can only submit expenses for yourself', new \Illuminate\Support\MessageBag(['general' => 'You can only submit expenses for yourself']));
     }
     $expense = $this->expenseRepository->create($data);
     event(new NewExpenseSubmitted($expense));
     return \Response::json($expense, 201);
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:33,代码来源:ExpensesController.php

示例5: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case '404':
                 \Log::error($e);
                 return \Response::view('errors.404');
                 break;
             case '500':
                 \Log::error($e);
                 return \Response::view('errors.500');
                 break;
             case '503':
                 \Log::error($e);
                 return \Response::view('errors.503');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         //return parent::render($request, $e);
         return \Response::view('errors.failure');
     }
 }
开发者ID:luigilapa,项目名称:CuentasFacturas,代码行数:32,代码来源:Handler.php

示例6: init

 /**
  * Creates a Laravel route, returning a closure which passes the raw input to AngularPHP and returns the response
  */
 protected function init()
 {
     $route = func_get_arg(0);
     $this->setErrorHandler(function (\Exception $e, Request $r) {
         \Log::error($e, $r->toArray());
     });
     $endpoint = $this;
     \Route::any($route, function () use($endpoint) {
         $path = '/' . \Request::path();
         $referrer = \Request::header('referer');
         $host = \Request::header('host');
         if (($origin = \Request::header('Origin')) && count($this->corsHosts)) {
             $this->setCorsOrigin($origin);
         }
         /**
          * If being called remotely, add the domain name to the URI
          */
         if (strlen($referrer) && parse_url($referrer, PHP_URL_HOST) != $host) {
             $uri = '//' . $host . $path;
         } else {
             $uri = $path;
         }
         $request = new Request(\Request::json()->all());
         $response = $endpoint->setUri($uri)->execute($request, \Request::getMethod());
         return \Response::make($response->content, $response->code, $response->headers)->header('Content-Type', $response->contentType);
     });
 }
开发者ID:echobot,项目名称:angularphp,代码行数:30,代码来源:Laravel.php

示例7: generateFeed

 public function generateFeed()
 {
     $articles = $this->getArticles();
     $feed = Feed::make();
     // set your feed's title, description, link, pubdate and language
     $feed->title = 'cnBeta1';
     $feed->description = '一个干净、现代、开放的cnBeta';
     $feed->logo = 'http://cnbeta1.com/assets/img/cnbeta1.png';
     $feed->link = URL::to('feed');
     $feed->pubdate = $articles[0]['date'];
     $feed->lang = 'zh-cn';
     foreach ($articles as $article) {
         $articleModel = new Article($article['article_id']);
         try {
             $articleModel->load();
         } catch (Exception $ex) {
             Log::error('feed: fail to fetch article: ' . $article['article_id'] . ', error: ' . $ex->getMessage());
         }
         $content = $article['intro'];
         $content .= $articleModel->data['content'] ? $articleModel->data['content'] : '';
         // set item's title, author, url, pubdate, description and content
         $feed->add($article['title'], 'cnBeta1', URL::to($article['article_id']), $article['date'], $content, $content);
     }
     $this->data = $feed->render('atom', -1);
     $this->saveToCache();
 }
开发者ID:undownding,项目名称:cnBeta1,代码行数:26,代码来源:ArticleFeed.php

示例8: action_term

 public function action_term()
 {
     $id = (int) $this->request->param('id', 0);
     $term = ORM::factory('term', $id);
     if (!$term->loaded()) {
         throw HTTP_Exception::factory(404, 'Term ":term" Not Found', array(':term' => $id));
     }
     $this->title = __(':title', array(':title' => $term->name));
     $view = View::factory('taxonomy/term')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts);
     $posts = $term->posts;
     if (!ACL::check('administer terms') and !ACL::check('administer content')) {
         $posts->where('status', '=', 'publish');
     }
     $total = $posts->reset(FALSE)->count_all();
     if ($total == 0) {
         Log::error('No posts found.');
         $this->response->body(View::factory('page/none'));
         return;
     }
     $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 5, 'uri' => $term->url));
     $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $this->response->body($view);
     //Set the canonical and shortlink for search engines
     if ($this->auto_render === TRUE) {
         Meta::links(URL::canonical($term->url, $pagination), array('rel' => 'canonical'));
         Meta::links(Route::url('taxonomy', array('action' => 'term', 'id' => $term->id)), array('rel' => 'shortlink'));
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:28,代码来源:taxonomy.php

示例9: storeMessageResource

 /**
  * storeMessageResource.
  *
  * @param int   $accountId 公众号id
  * @param array $message   消息
  *
  * @return int 消息资源id
  */
 private function storeMessageResource($accountId, $message)
 {
     $resourceModel = new $this->resourceModel();
     //$resourceModel->account_id =
     //
     \Log::error($message);
 }
开发者ID:renyang9876,项目名称:viease,代码行数:15,代码来源:MessageRepository.php

示例10: get

 /**
  * Get the translation for the given key. Log a warning if we have to fall 
  * back to the fallback locale and log an error if the fallback doesn't 
  * exist either.
  *
  * @param  string  $key
  * @param  array   $replace
  * @param  string  $locale
  * @return string
  */
 public function get($key, array $replace = array(), $locale = null)
 {
     list($namespace, $group, $item) = $this->parseKey($key);
     // Don't log issues if looking for custom validation messages
     $ignore = strpos($key, 'validation.custom.') === 0;
     $locales = $this->parseLocale($locale);
     $tried = array();
     foreach ($locales as $locale) {
         $this->load($namespace, $group, $locale);
         $line = $this->getLine($namespace, $group, $locale, $item, $replace);
         if ($line !== null) {
             break;
         }
         $tried[] = $locale;
     }
     if ($line === null) {
         // Not found
         if (!$ignore) {
             \Log::error("No translation found in any locale for key '{$key}'; " . "rendering the key instead " . "(tried " . implode(", ", $tried) . ")");
         }
         return $key;
     }
     if (count($tried)) {
         if (!$ignore) {
             \Log::warning("Fell back to {$locale} locale for translation key '{$key}' " . "(tried " . implode(", ", $tried) . ")");
         }
     }
     return $line;
 }
开发者ID:tremby,项目名称:laravel-warning-translator,代码行数:39,代码来源:WarningTranslator.php

示例11: send_notification

 public function send_notification($devices, $message)
 {
     try {
         $errCounter = 0;
         $payload = json_encode(array('aps' => $message));
         $result = 0;
         $bodyError = '';
         foreach ($devices as $key => $value) {
             $msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', $value)) . pack('n', strlen($payload)) . $payload;
             $result = fwrite($this->fp, $msg);
             $bodyError .= 'result: ' . $result . ', devicetoken: ' . $value;
             if (!$result) {
                 $errCounter = $errCounter + 1;
             }
         }
         //echo 'Result :- '.$result;
         if ($result) {
             Log::info('Delivered Message to APNS' . PHP_EOL);
             //echo 'Delivered Message to APNS' . PHP_EOL;
             $bool_result = true;
         } else {
             Log::info('Could not Deliver Message to APNS' . PHP_EOL);
             //echo 'Could not Deliver Message to APNS' . PHP_EOL;
             $bool_result = false;
         }
         fclose($this->fp);
         return $bool_result;
     } catch (Exception $e) {
         Log::error($e);
     }
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:31,代码来源:apns.php

示例12: store

 public function store()
 {
     $rules = array('name' => 'required|max:200', 'email' => 'required|email|unique:users|max:200|', 'password' => 'required|min:8|max:200');
     $messages = array('email.unique' => "You have already registered with this email address. Sign in <a href=\"/login\">here</a>");
     $input = Input::all();
     $validator = Validator::make($input, $rules, $messages);
     if ($validator->fails()) {
         return Redirect::to('signup')->withInput()->withErrors($validator);
     } else {
         $password = Hash::make($input['password']);
         //Validation passed -- Make a new user in the DB
         $user = new User();
         $user->name = $input['name'];
         $user->password = $password;
         $user->email = $input['email'];
         $user->isActive = 1;
         $user->save();
         //Here we will send an email with the link to confirm .... https://github.com/Zizaco/confide
         //We'll send the user an email thanking them for registering
         $attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password']));
         if ($attempt) {
             return Redirect::to('dashboard')->with('flash_message_good', 'Welcome to Open Source Collaborative Consumption Marketplace. You have been successfully signed up and logged in!');
         } else {
             Log::error('Trying to log user in straight after register failed. User redirected to login page');
             return Redirect::to('login')->with('flash_message_good', "Your signup has been successfull, go ahead and log in here!");
         }
     }
 }
开发者ID:s-matic,项目名称:collab-consumption,代码行数:28,代码来源:ProfileController.php

示例13: store

 /**
  * Store a newly created session in storage.
  * POST /session
  *
  * @return Response
  */
 public function store()
 {
     // Attempt to login
     try {
         // Login credentials
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // Authenticate the user
         if (Auth::attempt($credentials)) {
             // Store Session values for user
             Session::put('email', $credentials['email']);
             Session::put('user_id', User::getIdFromEmail($credentials['email']));
             // Redirect to dashboard with message
             Session::flash('alert_success', 'Logged in successfully.');
             return Redirect::intended('dashboard');
         } else {
             Session::flash('alert_warning', 'Unable to login. Please check your username and password, and try again.');
             return Redirect::to(secure_url('/login'))->withInput();
         }
     } catch (\RuntimeException $e) {
         // An unexpected error occurred.
         Log::error(date("Y-m-d H:i:s") . '- RuntimeException in app/contorllers/SessionController: ' . '\\$data = ' . print_r($data) . $e);
         Session::flash('alert_danger', 'An unexpected error occurred.');
         return Redirect::to(secure_url('/login'))->withInput();
     }
 }
开发者ID:julianfresco,项目名称:mentorshipLog,代码行数:31,代码来源:SessionController.php

示例14: handle

 public function handle()
 {
     $eventId = $this->request->input('event_id');
     $organizationId = $this->request->input('attendee.organization_id');
     if (empty($eventId)) {
         throw new Exception("EventID empty.");
     }
     if (empty($organizationId)) {
         throw new Exception("OrganizationID empty.");
     }
     $attendeeData = array('event_id' => $eventId, 'organization_id' => $organizationId, 'firstname' => $this->request->input('attendee.firstname'), 'lastname' => $this->request->input('attendee.lastname'), 'email' => $this->request->input('attendee.email'), 'registration_date' => BaseDateTime::now());
     $attendeeApplicationFormData = array('student_phone' => $this->request->input('attendee_application_form.phone'), 'student_grade' => $this->request->input('attendee_application_form.grade'), 'language' => $this->request->input('attendee_application_form.language'), 'sweatshirt_size' => $this->request->input('attendee_application_form.sweatshirt_size'), 'address' => $this->request->input('attendee_application_form.address'), 'city' => $this->request->input('attendee_application_form.city'), 'state' => $this->request->input('attendee_application_form.state'), 'zipcode' => $this->request->input('attendee_application_form.zipcode'), 'country' => 'USA', 'birthdate' => Carbon::parse($this->request->input('attendee_application_form.birthdate')));
     $attendeeHealthReleaseFormData = array('gender' => $this->request->input('attendee_health_release_form.gender'), 'emg_contactname' => $this->request->input('attendee_health_release_form.emgcontactname'), 'emg_contactrel' => $this->request->input('attendee_health_release_form.emgcontactrel'), 'emg_contactnumber' => $this->request->input('attendee_health_release_form.emgcontactnumber'), 'healthproblems' => $this->request->input('attendee_health_release_form.healthproblems'), 'allergies' => $this->request->input('attendee_health_release_form.allergies'), 'lasttetanusshot' => Carbon::parse($this->request->input('attendee_health_release_form.lasttetanusshot')), 'lastphysicalexam' => Carbon::parse($this->request->input('attendee_health_release_form.lastphysicalexam')), 'insurancecarrier' => $this->request->input('attendee_health_release_form.insurancecarrier'), 'insurancepolicynum' => $this->request->input('attendee_health_release_form.insurancepolicynum'), 'guardian_name' => $this->request->input('attendee_health_release_form.guardianfullname'), 'guardian_contact' => $this->request->input('attendee_health_release_form.guardian_phone'), 'guardian_relation' => $this->request->input('attendee_health_release_form.relationship'), 'guardian_sign' => $this->request->input('parent_signature'));
     $appForm = new AttendeeApplicationForm($attendeeApplicationFormData);
     $healthReleaseForm = new AttendeeHealthReleaseForm($attendeeHealthReleaseFormData);
     $eventRepo = new EventRepository();
     $event = $eventRepo->findById($eventId);
     $organizationRepo = new OrganizationRepository();
     $organization = $organizationRepo->findById($organizationId);
     $newAttendee = new Attendee($attendeeData);
     // Save new attendee
     $newAttendee = $newAttendee->create($attendeeData);
     $newAttendee->application_form()->save($appForm);
     $newAttendee->health_release_form()->save($healthReleaseForm);
     $newAttendee->save();
     if (!empty($newAttendee->id)) {
         try {
             $this->dispatch(new SendRegistrationConfirmation($newAttendee, $event));
         } catch (Exception $e) {
             Log::error('Could not process SendRegistrationConfirmation job.');
         }
     }
 }
开发者ID:dirtyblankets,项目名称:allaccessrms,代码行数:33,代码来源:RegisterAttendee.php

示例15: codes

 /**
  * {@inheritdoc}
  */
 public function codes()
 {
     $codes = $this->getCache('phone_codes');
     if (!$codes) {
         try {
             $codes = array();
             $countries = $this->countries->all();
             if ($countries && !empty($countries)) {
                 $response = $this->http->client()->get($this->url);
                 $result = $this->http->result($response);
                 if ($result) {
                     $result = $response->json();
                     foreach ($result as $country) {
                         if (array_key_exists($country['alpha2Code'], $countries)) {
                             if (isset($country['callingCodes'][0]) && !empty($country['callingCodes'][0])) {
                                 $codes[$country['alpha2Code']] = '+' . $country['callingCodes'][0];
                             }
                         }
                     }
                 }
             }
             if (empty($codes)) {
                 $codes = false;
             }
         } catch (Exception $exception) {
             \Log::error($exception->getMessage());
         }
     }
     return $codes;
 }
开发者ID:masikonis,项目名称:laravel-geography,代码行数:33,代码来源:RestcountriesPhones.php


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