當前位置: 首頁>>代碼示例>>PHP>>正文


PHP File::warning方法代碼示例

本文整理匯總了PHP中Phalcon\Logger\Adapter\File::warning方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::warning方法的具體用法?PHP File::warning怎麽用?PHP File::warning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phalcon\Logger\Adapter\File的用法示例。


在下文中一共展示了File::warning方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: saveAction

 public function saveAction()
 {
     $this->view->title = "Збереження студента";
     $errors = array();
     !file_exists($this->logFileName) ? $attr = array('mode' => 'w') : ($attr = array());
     $logger = new FileAdapter($this->logFileName, $attr);
     $manager = new \Phalcon\Mvc\Model\Transaction\Manager();
     $transaction = $manager->get();
     $indCode = $this->request->get("ind_code");
     if ($indCode != NULL) {
         $logger->log("indCode not NULL");
         if ($this->request->isPost()) {
             $logger->log("POST request finded");
             //debug($this->request->get());
             if ($this->request->get("uid") == NULL) {
                 $user = new \Users();
                 $logger->log("new User created");
             } else {
                 $user = \Users::findFirst($this->request->get("uid"));
                 if (!$user) {
                     $logger->warning("this User is not finded!");
                     $user = new \Users();
                     $logger->log("new User created");
                 } else {
                     $logger->log("User id is " . $user->id);
                 }
             }
             $user->setTransaction($transaction);
             $logger->log("Transaction started");
             $user->name = $this->request->get("name");
             $user->last_name = $this->request->get("last_name");
             $user->second_name = $this->request->get("second_name");
             $user->login = $this->request->get("login");
             $user->password = MD5($this->request->get("password"));
             $user->is_male = $this->request->get("is_male");
             $user->is_active = 1;
             $user->email = $this->request->get("email");
             $user->date_registration = date('Y-m-d H:i:s');
             $user->birthday = $this->request->get("birthday");
             $user->address_home = $this->request->get("address_home");
             $user->phome = $this->request->get("phome");
             $user->pmobile = $this->request->get("pmobile");
             if ($this->request->get("id") == NULL) {
                 $student = new \Students();
                 $logger->log("new Student created");
             } else {
                 $student = \Students::findFirst($this->request->get("id"));
                 if (!$student) {
                     $logger->warning("this Student is not finded!");
                     $student = new \Students();
                     $logger->log("new Student created");
                 } else {
                     $logger->log("Student id is " . $user->id);
                 }
             }
             //добавление студента
             $student->ind_code = $indCode;
             if (count($this->request->get("student_education")) > 0) {
                 $logger->log("student educations from request count>0, so start to add its");
                 $studentEducations = array();
                 //добавление образований
                 $c = 0;
                 foreach ($this->request->get("student_education") as $educ) {
                     $logger->log("Educ cycle #" . $c++);
                     $educJSON = json_decode($educ, true);
                     $se = new \StudentsEducation();
                     if (!array_key_exists("education_child_id", $educJSON)) {
                         $se->education_id = $educJSON["education_id"];
                     } else {
                         $se->education_id = $educJSON["education_child_id"];
                     }
                     $se->institution = $educJSON["institution"];
                     $se->speciality = $educJSON["speciality"];
                     $se->qualify = $educJSON["qualify"];
                     $se->diploma_number = $educJSON["diploma_number"];
                     $se->diploma_date = $educJSON["diploma_date"];
                     $logger->log("Educ id = " . $educJSON["education_id"]);
                     $studentEducations[] = $se;
                 }
             } else {
                 $logger->warning("No educations in request!");
                 $studentEducations = NULL;
             }
             if ($student->StudentsEducation->count() > 0) {
                 $logger->warning("Finded old education(s) (" . $student->StudentsEducation->count() . ") in this Student. Trying to delete all its");
                 $c = 0;
                 foreach ($student->StudentsEducation as $se) {
                     $logger->log("Educ delation cycle #" . $c++);
                     $se->delete();
                 }
             } else {
                 $logger->warning("no old educations finded!");
             }
             $student->StudentsEducation = $studentEducations;
             //debug($student->StudentsEducation);
             if (count($this->request->get("student_post")) > 0) {
                 $logger->log("There is Posts in request");
                 $studentPosts = array();
                 //добавление должностей
                 $logger->log("new Posts addition");
//.........這裏部分代碼省略.........
開發者ID:sergeytkachenko,項目名稱:angular-gulp-phalcon,代碼行數:101,代碼來源:StudentController.php

示例2: testWarningLogging

 /**
  * Tests WARNING logging with warning()
  *
  * @author Nikos Dimopoulos <nikos@phalconphp.com>
  * @since  2012-09-17
  */
 public function testWarningLogging()
 {
     $fileName = $this->getFileName('log', 'log');
     $logger = new PhLoggerAdapterFile($this->logPath . $fileName);
     $logger->warning('Hello');
     $logger->close();
     $contents = file($this->logPath . $fileName);
     $found = strpos($contents[0], '[WARNING]');
     $this->assertTrue($found !== FALSE, 'Warning logging is not set to WARNING');
     $found = strpos($contents[0], 'Hello');
     $this->assertTrue($found !== FALSE, 'Warning logging does not set correct message');
     $this->cleanFile($this->logPath, $fileName);
 }
開發者ID:starsw001,項目名稱:cphalcon,代碼行數:19,代碼來源:UnitTest.php

示例3: array

 * Save module name to be used when routes will be registered.
 */
$modulesName = array();
foreach ($modules as $namespace => $path) {
    $modulesName[] = basename($path);
    $module = $namespace . '\\Module';
    $module = new $module();
}
$app = new Phalcon\Mvc\Micro();
$app->setDI($di);
/**
 * Add exception handler to show them in json 
 */
set_exception_handler(function ($e) use($app) {
    $logger = new FileAdapter('debug.log');
    $logger->warning($e->getMessage());
    if (method_exists($e, 'send')) {
        $e->send();
    }
    $logger->error($e->getTraceAsString());
});
/**
 * Mount all collections (Makes routes active).
 * @todo improve this block of code
 */
foreach ($modulesName as $module) {
    $routeDefinitions = array('GET' => array(), 'POST' => array(), 'PUT' => array(), 'DELETE' => array());
    try {
        foreach ($di->get('collections_' . $module) as $collection) {
            $app->mount($collection);
            $routes = $app->getRouter()->getRoutes();
開發者ID:enriqueojedalara,項目名稱:reddit-demo,代碼行數:31,代碼來源:index.php

示例4: warning

 public function warning($msg)
 {
     $this->logger->warning($msg);
 }
開發者ID:muramoya,項目名稱:kotori,代碼行數:4,代碼來源:Logger.php


注:本文中的Phalcon\Logger\Adapter\File::warning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。