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


PHP Tlog::getNewInstance方法代码示例

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


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

示例1: getLog

 /**
  * Initialize a module-specific logger.
  *
  * @return Tlog a Tlog instance
  */
 protected function getLog()
 {
     if ($this->log == null) {
         $this->log = Tlog::getNewInstance();
         $logFilePath = sprintf(THELIA_ROOT . "log" . DS . "%s.log", strtolower($this->getModuleCode()));
         $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:alex63530,项目名称:thelia,代码行数:16,代码来源:BasePaymentModuleController.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: __construct

 public function __construct()
 {
     $this->logger = Tlog::getNewInstance();
     $this->logger->setDestinations(static::LOG_CLASS);
     $this->logger->setConfig(self::LOG_CLASS, 0, THELIA_ROOT . "log" . DS . "log-shopping-flux.txt");
     /**
      * Create a fake user ShoppingFlux if it doesn't exist
      */
     $this->shoppingFluxCustomer = ShoppingFluxConfigQuery::createShoppingFluxCustomer();
     $this->shoppingFluxPaymentModule = (new ShoppingFlux())->getModuleModel();
     $this->shoppingFluxPaymentModuleId = $this->shoppingFluxPaymentModule->getId();
 }
开发者ID:ThomasArnaud,项目名称:ShoppingFlux,代码行数:12,代码来源:ApiCall.php

示例4: setUp

 public function setUp()
 {
     new Translator(new Container());
     Tlog::getNewInstance();
     $cacheDir = THELIA_CACHE_DIR . "test";
     if (!is_dir($cacheDir)) {
         mkdir($cacheDir);
     }
     $this->tar = $this->getArchiveBuilder();
     if (!$this->tar->isAvailable()) {
         $this->markTestSkipped("The " . $this->tar->getExtension() . " archiver can't be tested as its dependencies are not installed/configured in this context");
     }
     $this->tar->setEnvironment("test");
 }
开发者ID:alex63530,项目名称:thelia,代码行数:14,代码来源:TarArchiveBuilderTest.php

示例5: setUp

 public function setUp()
 {
     new Translator(new Container());
     Tlog::getNewInstance();
     $cacheDir = THELIA_CACHE_DIR . "test";
     if (!is_dir($cacheDir)) {
         mkdir($cacheDir);
     }
     $this->zip = new ZipArchiveBuilder();
     if (!$this->zip->isAvailable()) {
         $this->markTestSkipped("The " . $this->zip->getExtension() . " archiver can't be tested as its dependencies are not installed/configured in this context");
     }
     $this->zip->setEnvironment("test");
     $this->loadedZip = $this->zip->loadArchive(__DIR__ . DS . "TestResources/well_formatted.zip");
 }
开发者ID:margery,项目名称:thelia,代码行数:15,代码来源:ZipArchiveBuilderTest.php

示例6: setUp

 public function setUp()
 {
     $logger = Tlog::getNewInstance();
     $translator = new Translator(new Container());
     $this->downloader = new FileDownloader($logger, $translator);
 }
开发者ID:margery,项目名称:thelia,代码行数:6,代码来源:FileDownloaderTest.php

示例7: __construct

 public function __construct()
 {
     $this->translator = Translator::getInstance();
     $this->logger = Tlog::getNewInstance();
 }
开发者ID:margery,项目名称:thelia,代码行数:5,代码来源:AbstractArchiveBuilder.php

示例8: setUp

 public function setUp()
 {
     Tlog::getNewInstance();
     $this->session = $this->getSession();
     $this->container = $this->getContainer();
 }
开发者ID:alex63530,项目名称:thelia,代码行数:6,代码来源:ContainerAwareTestCase.php

示例9: getExport

 public function getExport($generateOnly = false)
 {
     $env = $this->container->getParameter("kernel.environment");
     $theliaCacheDirectory = THELIA_CACHE_DIR . $env . DS;
     $generateFile = true;
     $writeCache = false;
     /**
      * Error logging tools
      */
     $logger = Tlog::getNewInstance();
     $logger->setDestinations(static::LOG_CLASS);
     $logger->setConfig(self::LOG_CLASS, 0, THELIA_ROOT . "log" . DS . "log-shopping-flux.txt");
     $translator = Translator::getInstance();
     $cacheDirectory = $theliaCacheDirectory . static::SHOPPING_FLUX_CACHE_DIR . DS;
     $cacheFile = $cacheDirectory . static::CACHE_FILE_NAME;
     /**
      * Check if the file exists, if it is readable and if
      * we have to get the cache or save it.
      */
     if (file_exists($cacheFile)) {
         if (!is_readable($cacheFile)) {
             $logger->warning($translator->trans("The file %file is not readable, the cache can't be used", ["%file" => $cacheFile], ShoppingFlux::MESSAGE_DOMAIN));
         } else {
             $time = @filemtime($cacheFile);
             if (false === $time) {
                 $logger->error($translator->trans("Unknown error while getting %file update time", ["%file" => $cacheFile], ShoppingFlux::MESSAGE_DOMAIN));
             } elseif ($time < ($limitTime = time() - static::CACHE_TIME_HOUR * 3600)) {
                 /**
                  * If the cache is too old
                  */
                 if (!is_writable($cacheFile)) {
                     $logger->warning($translator->trans("The file %file is not writable, the cache can't be saved", ["%file" => $cacheFile], ShoppingFlux::MESSAGE_DOMAIN));
                 } else {
                     $writeCache = true;
                 }
             } elseif ($time >= $limitTime) {
                 $generateFile = false;
             }
         }
     } else {
         /**
          * Check if the cache directory exists,
          * if not, create it.
          */
         if (!file_exists($cacheDirectory)) {
             if (!@mkdir($cacheDirectory)) {
                 $logger->warning($translator->trans("Unable to create the cache directory %dir", ["%dir" => $cacheDirectory], ShoppingFlux::MESSAGE_DOMAIN));
             } else {
                 $writeCache = true;
             }
         }
     }
     if (is_file($cacheDirectory) && !unlink($cacheDirectory)) {
         $logger->warning($translator->trans("Unable to create the cache directory, a file named %dir exists and can't be deleted", ["%dir" => $cacheDirectory], ShoppingFlux::MESSAGE_DOMAIN));
     } elseif (is_dir($cacheDirectory)) {
         if (!is_writable($cacheDirectory)) {
             $logger->warning($translator->trans("The directory %dir is not writable, the cache file can't be saved", ["%dir" => $cacheDirectory], ShoppingFlux::MESSAGE_DOMAIN));
         } elseif (!file_exists($cacheFile)) {
             $writeCache = true;
         }
     }
     /**
      * Then when everything's ok ( directory created if not ) go.
      */
     if ($generateFile) {
         $content = ShoppingFluxConfigQuery::exportXML($this->container);
     } elseif (!$generateOnly) {
         $content = file_get_contents($cacheFile);
     } else {
         $content = null;
     }
     if ($writeCache && $content !== null) {
         file_put_contents($cacheFile, $content);
     }
     if ($generateOnly) {
         return !($generateFile ^ $writeCache) && is_writable($cacheFile);
     }
     return new Response($content, 200, ["Content-type" => "application/xml"]);
 }
开发者ID:ThomasArnaud,项目名称:ShoppingFlux,代码行数:79,代码来源:GetExportController.php


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