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


PHP Log\Tlog类代码示例

本文整理汇总了PHP中Thelia\Log\Tlog的典型用法代码示例。如果您正苦于以下问题:PHP Tlog类的具体用法?PHP Tlog怎么用?PHP Tlog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateToVersion

 protected function updateToVersion($version, Database $database, Tlog $logger)
 {
     if (file_exists(THELIA_ROOT . '/setup/update/' . $version . '.sql')) {
         $logger->debug(sprintf('inserting file %s', $version . '$sql'));
         $database->insertSql(null, array(THELIA_ROOT . '/setup/update/' . $version . '.sql'));
         $logger->debug(sprintf('end inserting file %s', $version . '$sql'));
     }
     ConfigQuery::write('thelia_version', $version);
 }
开发者ID:alex63530,项目名称:thelia,代码行数:9,代码来源:Update.php

示例2: getLogger

 /**
  * Returns the module-specific logger, initializing it if required.
  *
  * @return Tlog a Tlog instance
  */
 public function getLogger()
 {
     if ($this->log == null) {
         $this->log = Tlog::getNewInstance();
         $logFilePath = $this->getLogFilePath();
         $this->log->setPrefix("#LEVEL: #DATE #HOUR: ");
         $this->log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationFile");
         $this->log->setConfig("\\Thelia\\Log\\Destination\\TlogDestinationFile", 0, $logFilePath);
     }
     return $this->log;
 }
开发者ID:Alban-io,项目名称:Payline,代码行数:16,代码来源:PaylineLogger.php

示例3: createRuleAction

 public function createRuleAction()
 {
     if (null !== ($response = $this->checkAuth(array(), array('FreeShipping'), AccessManager::CREATE))) {
         return $response;
     }
     $ruleCreationForm = new FreeShippingRuleCreationForm($this->getRequest());
     $message = false;
     try {
         $form = $this->validateForm($ruleCreationForm);
         $event = $this->createEventInstance($form->getData());
         $this->areaId = $form->get('area')->getData();
         if (null === $this->getExistingObject()) {
             $this->dispatch(FreeShippingEvents::FREE_SHIPPING_RULE_CREATE, $event);
             return $this->generateSuccessRedirect($ruleCreationForm);
         } else {
             throw new \Exception("A rule with this area already exist");
         }
     } catch (FormValidationException $e) {
         $message = sprintf("Please check your input: %s", $e->getMessage());
     } catch (PropelException $e) {
         $message = $e->getMessage();
     } catch (\Exception $e) {
         $message = sprintf("Sorry, an error occured: %s", $e->getMessage() . " " . $e->getFile());
     }
     if ($message !== false) {
         \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during free shipping rule creation process : %s.", $message));
         $ruleCreationForm->setErrorMessage($message);
         $this->getParserContext()->addForm($ruleCreationForm)->setGeneralError($message);
     }
     // Redirect
     return $this->generateRedirectFromRoute('admin.module.configure', array(), array('module_code' => 'FreeShipping'));
 }
开发者ID:Asenar,项目名称:thelia-FreeShipping,代码行数:32,代码来源:FreeShippingController.php

示例4: logAlertMessage

 protected function logAlertMessage($message, $failSafe = false)
 {
     Tlog::getInstance()->addAlert($message);
     if (!$failSafe && $this->debugEnabled) {
         throw new \InvalidArgumentException($message);
     }
 }
开发者ID:thelia,项目名称:core,代码行数:7,代码来源:RegisterHookListenersPass.php

示例5: updateStatus

 public function updateStatus(OrderEvent $event)
 {
     $order = $event->getOrder();
     $paidStatusId = OrderStatusQuery::create()->filterByCode(OrderStatus::CODE_PAID)->select('Id')->findOne();
     if ($order->hasVirtualProduct() && $event->getStatus() == $paidStatusId) {
         $contact_email = ConfigQuery::read('store_email');
         if ($contact_email) {
             $message = MessageQuery::create()->filterByName('mail_virtualproduct')->findOne();
             if (false === $message) {
                 throw new \Exception("Failed to load message 'mail_virtualproduct'.");
             }
             $order = $event->getOrder();
             $customer = $order->getCustomer();
             $this->parser->assign('customer_id', $customer->getId());
             $this->parser->assign('order_id', $order->getId());
             $this->parser->assign('order_ref', $order->getRef());
             $this->parser->assign('order_date', $order->getCreatedAt());
             $this->parser->assign('update_date', $order->getUpdatedAt());
             $message->setLocale($order->getLang()->getLocale());
             $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name'));
             // Build subject and body
             $message->buildMessage($this->parser, $instance);
             $this->mailer->send($instance);
             Tlog::getInstance()->debug("Virtual product download message sent to customer " . $customer->getEmail());
         } else {
             $customer = $order->getCustomer();
             Tlog::getInstance()->debug("Virtual product download message no contact email customer_id", $customer->getId());
         }
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:30,代码来源:SendMail.php

示例6: updateStatus

 public function updateStatus(OrderEvent $event)
 {
     $order = $event->getOrder();
     $Predict = new Predict();
     if ($order->isSent() && $order->getDeliveryModuleId() == $Predict->getModuleModel()->getId()) {
         $contact_email = ConfigQuery::read('store_email');
         if ($contact_email) {
             $message = MessageQuery::create()->filterByName('mail_predict')->findOne();
             if (false === $message) {
                 throw new \Exception(Translator::getInstance()->trans("Failed to load message '%mail_tpl_name'.", ["%mail_tpl_name" => "mail_predict"], Predict::MESSAGE_DOMAIN));
             }
             $order = $event->getOrder();
             $customer = $order->getCustomer();
             $this->parser->assign('customer_id', $customer->getId());
             $this->parser->assign('order_ref', $order->getRef());
             $this->parser->assign('order_date', $order->getCreatedAt());
             $this->parser->assign('order_id', $order->getId());
             $this->parser->assign('update_date', $order->getUpdatedAt());
             $this->parser->assign('package', $order->getDeliveryRef());
             $message->setLocale($order->getLang()->getLocale());
             $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name'));
             // Build subject and body
             $message->buildMessage($this->parser, $instance);
             $this->mailer->send($instance);
             Tlog::getInstance()->debug("Predict shipping message sent to customer " . $customer->getEmail());
         } else {
             $customer = $order->getCustomer();
             Tlog::getInstance()->debug("Predict shipping message no contact email customer_id", $customer->getId());
         }
     }
 }
开发者ID:lopes-vincent,项目名称:Predict,代码行数:31,代码来源:SendMail.php

示例7: addItem

 public function addItem()
 {
     $request = $this->getRequest();
     $cartAdd = $this->getAddCartForm($request);
     $message = null;
     try {
         $form = $this->validateForm($cartAdd);
         $cartEvent = $this->getCartEvent();
         $cartEvent->bindForm($form);
         $this->getDispatcher()->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent);
         $this->afterModifyCart();
         if ($this->getRequest()->isXmlHttpRequest()) {
             $this->changeViewForAjax();
         } else {
             if (null !== ($response = $this->generateSuccessRedirect($cartAdd))) {
                 return $response;
             }
         }
     } catch (PropelException $e) {
         Tlog::getInstance()->error(sprintf("Failed to add item to cart with message : %s", $e->getMessage()));
         $message = $this->getTranslator()->trans("Failed to add this article to your cart, please try again", [], Front::MESSAGE_DOMAIN);
     } catch (FormValidationException $e) {
         $message = $e->getMessage();
     }
     if ($message) {
         $cartAdd->setErrorMessage($message);
         $this->getParserContext()->addForm($cartAdd);
     }
 }
开发者ID:bcbrr,项目名称:LegacyProductAttributes,代码行数:29,代码来源:CartController.php

示例8: updateStatus

 public function updateStatus(OrderEvent $event)
 {
     $order = $event->getOrder();
     $colissimo = new Colissimo();
     if ($order->isSent() && $order->getDeliveryModuleId() == $colissimo->getModuleModel()->getId()) {
         $contact_email = ConfigQuery::getStoreEmail();
         if ($contact_email) {
             $message = MessageQuery::create()->filterByName('mail_colissimo')->findOne();
             if (false === $message) {
                 throw new \Exception("Failed to load message 'order_confirmation'.");
             }
             $order = $event->getOrder();
             $customer = $order->getCustomer();
             $this->parser->assign('customer_id', $customer->getId());
             $this->parser->assign('order_ref', $order->getRef());
             $this->parser->assign('order_date', $order->getCreatedAt());
             $this->parser->assign('update_date', $order->getUpdatedAt());
             $this->parser->assign('package', $order->getDeliveryRef());
             $message->setLocale($order->getLang()->getLocale());
             $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::getStoreName());
             // Build subject and body
             $message->buildMessage($this->parser, $instance);
             $this->mailer->send($instance);
             Tlog::getInstance()->debug("Colissimo shipping message sent to customer " . $customer->getEmail());
         } else {
             $customer = $order->getCustomer();
             Tlog::getInstance()->debug("Colissimo shipping message no contact email customer_id", $customer->getId());
         }
     }
 }
开发者ID:NandoKstroNet,项目名称:thelia,代码行数:30,代码来源:SendMail.php

示例9: delete

 public function delete(ModuleDeleteEvent $event)
 {
     if (null !== ($module = ModuleQuery::create()->findPk($event->getModuleId()))) {
         $con = Propel::getWriteConnection(ModuleTableMap::DATABASE_NAME);
         $con->beginTransaction();
         try {
             if (null === $module->getFullNamespace()) {
                 throw new \LogicException(Translator::getInstance()->trans('Cannot instanciante module "%name%": the namespace is null. Maybe the model is not loaded ?', array('%name%' => $module->getCode())));
             }
             try {
                 $instance = $module->createInstance();
                 $instance->setContainer($this->container);
                 $path = $module->getAbsoluteBaseDir();
                 $instance->destroy($con, $event->getDeleteData());
                 $fs = new Filesystem();
                 $fs->remove($path);
             } catch (\ReflectionException $ex) {
                 // Happens probably because the module directory has been deleted.
                 // Log a warning, and delete the database entry.
                 Tlog::getInstance()->addWarning(Translator::getInstance()->trans('Failed to create instance of module "%name%" when trying to delete module. Module directory has probably been deleted', array('%name%' => $module->getCode())));
             }
             $module->delete($con);
             $con->commit();
             $event->setModule($module);
             $this->cacheClear($event->getDispatcher());
         } catch (\Exception $e) {
             $con->rollBack();
             throw $e;
         }
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:31,代码来源:Module.php

示例10: updateOrCreateLinkAction

 public function updateOrCreateLinkAction($id)
 {
     // Check current user authorization
     if (null !== ($response = $this->checkAuth(AdminResources::MODULE, DealerTeam::getModuleCode(), AccessManager::CREATE))) {
         return $response;
     }
     $retour = [];
     $code = 200;
     $con = Propel::getConnection();
     $con->beginTransaction();
     try {
         $data = ['id' => $id];
         $tempOption = $this->getRequest()->request->get("option_id");
         $dafyDealer = [];
         foreach ($tempOption as $option) {
             $data["dealer_option_id"] = $option;
             $temp = $this->getService()->createFromArray($data);
             if ($temp) {
                 $dafyDealer[] = $temp->toArray();
             }
         }
         $con->commit();
         $retour["data"] = $dafyDealer;
     } catch (\Exception $e) {
         $con->rollBack();
         // Any other error
         Tlog::getInstance()->addError($e->getMessage());
         $code = $e->getCode();
         if ($code == 0) {
             $code = 500;
         }
         $retour["message"] = $e->getMessage();
     }
     return JsonResponse::create($retour, $code);
 }
开发者ID:thelia-modules,项目名称:DealerTeam,代码行数:35,代码来源:DealerTeamController.php

示例11: subscribeAction

 public function subscribeAction()
 {
     $errorMessage = false;
     $newsletterForm = new NewsletterForm($this->getRequest());
     try {
         $form = $this->validateForm($newsletterForm);
         $event = new NewsletterEvent($form->get('email')->getData(), $this->getRequest()->getSession()->getLang()->getLocale());
         if (null !== ($customer = $this->getSecurityContext()->getCustomerUser())) {
             $event->setFirstname($customer->getFirstname());
             $event->setLastname($customer->getLastname());
         } else {
             $event->setFirstname($form->get('firstname')->getData());
             $event->setLastname($form->get('lastname')->getData());
         }
         $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event);
     } catch (\Exception $e) {
         $errorMessage = $e->getMessage();
         Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $errorMessage));
     }
     // If Ajax Request
     if ($this->getRequest()->isXmlHttpRequest()) {
         $response = new JsonResponse();
         if ($errorMessage) {
             $response = $response->setContent(array("success" => false, "message" => $errorMessage));
         } else {
             $response = $response->setContent(array("success" => true, "message" => $this->getTranslator()->trans("Thanks for signing up! We'll keep you posted whenever we have any new updates.")));
         }
         return $response;
     } else {
         $newsletterForm->setErrorMessage($errorMessage);
         $this->getParserContext()->addForm($newsletterForm)->setGeneralError($errorMessage);
     }
 }
开发者ID:badelas,项目名称:thelia,代码行数:33,代码来源:NewsletterController.php

示例12: subscribeAction

 public function subscribeAction()
 {
     $errorMessage = false;
     $newsletterForm = $this->createForm(FrontForm::NEWSLETTER);
     try {
         $form = $this->validateForm($newsletterForm);
         $event = new NewsletterEvent($form->get('email')->getData(), $this->getRequest()->getSession()->getLang()->getLocale());
         /** @var Customer $customer */
         if (null !== ($customer = $this->getSecurityContext()->getCustomerUser())) {
             $event->setFirstname($customer->getFirstname())->setLastname($customer->getLastname());
         } else {
             $event->setFirstname($form->get('firstname')->getData())->setLastname($form->get('lastname')->getData());
         }
         $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event);
         // If a success URL is defined in the form, redirect to it, otherwise use the defaut view
         if ($newsletterForm->hasSuccessUrl() && !$this->getRequest()->isXmlHttpRequest()) {
             return $this->generateSuccessRedirect($newsletterForm);
         }
     } catch (\Exception $e) {
         $errorMessage = $e->getMessage();
         Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $errorMessage));
         $newsletterForm->setErrorMessage($errorMessage);
     }
     // If Ajax Request
     if ($this->getRequest()->isXmlHttpRequest()) {
         return new JsonResponse(["success" => $errorMessage ? false : true, "message" => $errorMessage ? $errorMessage : $this->getTranslator()->trans("Thanks for signing up! We'll keep you posted whenever we have any new updates.", [], Front::MESSAGE_DOMAIN)], $errorMessage ? 500 : 200);
     }
     $this->getParserContext()->setGeneralError($errorMessage)->addForm($newsletterForm);
     // If an error URL is defined in the form, redirect to it, otherwise use the defaut view
     if ($errorMessage && $newsletterForm->hasErrorUrl()) {
         return $this->generateErrorRedirect($newsletterForm);
     }
 }
开发者ID:GuiminZHOU,项目名称:thelia,代码行数:33,代码来源:NewsletterController.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$logger = Tlog::getInstance();
     self::$logger->setDestinations("Thelia\\Log\\Destination\\TlogDestinationText");
     self::$logger->setLevel(Tlog::DEBUG);
     self::$logger->setFiles("*");
 }
开发者ID:alex63530,项目名称:thelia,代码行数:7,代码来源:TlogTest.php

示例14: parseResults

 public function parseResults(LoopResult $results)
 {
     $results = parent::parseResults($results);
     foreach ($results as $loopResultRow) {
         $accessoryProductId = $loopResultRow->get('ID');
         \Thelia\Log\Tlog::getInstance()->notice($this->accessoryId);
         $loopResultRow->set("ID", $this->accessoryId[$accessoryProductId])->set("POSITION", $this->accessoryPosition[$accessoryProductId])->set("ACCESSORY_ID", $accessoryProductId);
     }
     return $results;
 }
开发者ID:badelas,项目名称:thelia,代码行数:10,代码来源:Accessory.php

示例15: append

 /**
  * A simple helper to insert an entry in the admin log
  *
  * @param $resource
  * @param $action
  * @param $message
  * @param Request       $request
  * @param UserInterface $adminUser
  * @param bool          $withRequestContent
  */
 public static function append($resource, $action, $message, Request $request, UserInterface $adminUser = null, $withRequestContent = true)
 {
     $log = new AdminLog();
     $log->setAdminLogin($adminUser !== null ? $adminUser->getUsername() : '<no login>')->setAdminFirstname($adminUser !== null && $adminUser instanceof Admin ? $adminUser->getFirstname() : '<no first name>')->setAdminLastname($adminUser !== null && $adminUser instanceof Admin ? $adminUser->getLastname() : '<no last name>')->setResource($resource)->setAction($action)->setMessage($message)->setRequest($request->toString($withRequestContent));
     try {
         $log->save();
     } catch (\Exception $ex) {
         Tlog::getInstance()->err("Failed to insert new entry in AdminLog: {ex}", array('ex' => $ex));
     }
 }
开发者ID:badelas,项目名称:thelia,代码行数:20,代码来源:AdminLog.php


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