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


PHP MOXMAN::getLogger方法代码示例

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


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

示例1: onFileAction

 public function onFileAction(MOXMAN_Vfs_FileActionEventArgs $args)
 {
     $logger = MOXMAN::getLogger();
     if ($logger) {
         if ($args->getTargetFile()) {
             // Log copy/move operations these have a target file
             $logger->debug("Action: " . $args->getAction(), "Path: " . $args->getFile()->getPath(), "TargetPath: " . $args->getTargetFile()->getPath());
         } else {
             // Log single file operations
             $logger->debug("Action: " . $args->getAction(), "Path: " . $args->getFile()->getPath());
         }
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:13,代码来源:Plugin.php

示例2: processRequest

 /**
  * Sends the specified file with the correct mime type back to the browser.
  * This method gets called from the client side using the stream file.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     try {
         $file = MOXMAN::getFile($request->get("path"));
     } catch (Exception $e) {
         $response->setStatus("500", "Could not resolve path: " . $request->get("path"));
         if (MOXMAN::getLogger()) {
             MOXMAN::getLogger()->debug("Could not resolve path: " . $request->get("path"));
         }
         return;
     }
     // Create thumbnail
     if ($request->get("thumb")) {
         try {
             $file = $this->plugin->createThumbnail($file);
         } catch (Exception $e) {
             $response->setStatus("500", "Could not generate thumbnail.");
             $response->sendContent("Could not generate thumbnail.");
             return;
         }
     }
     // Fire before stream event
     $args = new MOXMAN_Vfs_StreamEventArgs($httpContext, $file);
     $this->plugin->fire("BeforeStream", $args);
     $file = $args->getFile();
     // Stream temp file if it exists
     if ($tempName = $request->get("tempname")) {
         $ext = MOXMAN_Util_PathUtils::getExtension($file->getName());
         $tempName = "mcic_" . md5(session_id() . $file->getName()) . "." . $ext;
         $tempFilePath = MOXMAN_Util_PathUtils::combine(MOXMAN_Util_PathUtils::getTempDir(), $tempName);
         if (file_exists($tempFilePath)) {
             $response->sendLocalFile($tempFilePath);
             return;
         }
     }
     $url = $file->getUrl();
     if ($url && !$request->get("stream", false)) {
         $response->redirect($url);
     } else {
         // Force 48h cache time
         $offset = 48 * 60 * 60;
         $response->setHeader("Cache-Control", "max-age=" . $offset);
         $response->setHeader("Date", gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
         $response->setHeader("Expires", gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
         $response->setHeader("Pragma", "public");
         $response->sendFile($file);
     }
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:56,代码来源:StreamFileHandler.php

示例3: onBeforeFileAction

 public function onBeforeFileAction(MOXMAN_Vfs_FileActionEventArgs $args)
 {
     switch ($args->getAction()) {
         case MOXMAN_Vfs_FileActionEventArgs::DELETE:
             $file = $args->getFile();
             $maxSize = $this->parseSize($file->getConfig()->get("quota.max_size", 0));
             if ($maxSize > 0) {
                 $this->currentSize = MOXMAN::getUserStorage()->get("quota.size", 0);
                 $this->currentSize = max(0, $this->currentSize - $file->getSize());
                 if (MOXMAN::getLogger()) {
                     MOXMAN::getLogger()->debug("[quota] Removed: " . $file->getPublicPath() . " (" . $this->formatSize($file->getSize()) . ").");
                 }
             }
             break;
         case MOXMAN_Vfs_FileActionEventArgs::COPY:
         case MOXMAN_Vfs_FileActionEventArgs::ADD:
             if (!isset($args->getData()->thumb)) {
                 $file = $args->getFile();
                 $targetFile = $args->getTargetFile();
                 if (!$file) {
                     return;
                 }
                 $publicPath = $targetFile ? $targetFile->getPublicPath() : $file->getPublicPath();
                 $maxSize = $this->parseSize($file->getConfig()->get("quota.max_size", 0));
                 if ($maxSize === 0) {
                     return;
                 }
                 $fileSize = 0;
                 // Get size of source directory in copy operation
                 if ($args->getAction() == MOXMAN_Vfs_FileActionEventArgs::COPY && $file->isDirectory()) {
                     $fileSize = $this->getDirectorySize($file);
                 } else {
                     if (isset($args->getData()->fileSize)) {
                         $fileSize = $args->getData()->fileSize;
                     }
                 }
                 $this->currentSize = MOXMAN::getUserStorage()->get("quota.size", 0);
                 if ($this->currentSize + $fileSize > $maxSize) {
                     throw new MOXMAN_Exception("Quota exceeded when adding file: " . $publicPath . " (" . $this->formatSize($this->currentSize + $fileSize) . " > " . $this->formatSize($maxSize) . ").");
                 }
                 $this->currentSize += $fileSize;
                 if (MOXMAN::getLogger()) {
                     MOXMAN::getLogger()->debug("[quota] Added: " . $file->getPublicPath() . " (" . $this->formatSize($fileSize) . ").");
                 }
             }
             break;
     }
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:48,代码来源:Plugin.php

示例4: log

 private function log($message)
 {
     $logger = MOXMAN::getLogger();
     if ($logger) {
         MOXMAN::getLogger()->debug($message);
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:7,代码来源:FileInfoStorage.php

示例5: logHttpClient

 /**
  * Logs HTTP client messages to log file with a specific prefix.
  *
  * @param mixed $str String to log.
  */
 public function logHttpClient($str)
 {
     MOXMAN::getLogger()->debug("[s3] " . $str);
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:9,代码来源:FileSystem.php


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