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


PHP Tlog::getInstance方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: process

 public function process()
 {
     $logger = Tlog::getInstance();
     $logger->setLevel(Tlog::DEBUG);
     $updatedVersions = array();
     $currentVersion = ConfigQuery::read('thelia_version');
     $logger->debug("start update process");
     if (true === $this->isLatestVersion($currentVersion)) {
         $logger->debug("You already have the latest version. No update available");
         throw new UpToDateException('You already have the latest version. No update available');
     }
     $index = array_search($currentVersion, self::$version);
     $con = Propel::getServiceContainer()->getWriteConnection(ProductTableMap::DATABASE_NAME);
     $con->beginTransaction();
     $logger->debug("begin transaction");
     $database = new Database($con->getWrappedConnection());
     try {
         $size = count(self::$version);
         for ($i = ++$index; $i < $size; $i++) {
             $this->updateToVersion(self::$version[$i], $database, $logger);
             $updatedVersions[] = self::$version[$i];
         }
         $con->commit();
         $logger->debug('update successfully');
     } catch (PropelException $e) {
         $con->rollBack();
         $logger->error(sprintf('error during update process with message : %s', $e->getMessage()));
         throw $e;
     }
     $logger->debug('end of update processing');
     return $updatedVersions;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:32,代码来源:Update.php

示例5: 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

示例6: 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

示例7: 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

示例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: 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

示例10: 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

示例11: 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

示例12: 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

示例13: setTLogPaypal

 /**
  * @return Tlog
  */
 protected function setTLogPaypal()
 {
     /*
      * Write Log
      */
     $this->log = Tlog::getInstance();
     $this->log->setDestinations(self::LOGCLASS);
     $this->log->setConfig(self::LOGCLASS, 0, THELIA_ROOT . "log" . DS . "log-paypal.txt");
 }
开发者ID:Asenar,项目名称:thelia-Paypal,代码行数:12,代码来源:PaypalApiLogManager.php

示例14: renderTemplate

 protected function renderTemplate()
 {
     $destinations = array();
     $destination_directories = Tlog::getInstance()->getDestinationsDirectories();
     foreach ($destination_directories as $dir) {
         $this->loadDefinedDestinations($dir, $destinations);
     }
     $active_destinations = explode(";", ConfigQuery::read(Tlog::VAR_DESTINATIONS, Tlog::DEFAUT_DESTINATIONS));
     return $this->render('system-logs', array('ip_address' => $this->getRequest()->getClientIp(), 'destinations' => $destinations, 'active_destinations' => $active_destinations));
 }
开发者ID:margery,项目名称:thelia,代码行数:10,代码来源:SystemLogController.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::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。