本文整理汇总了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());
}
}
}
示例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);
}
}
示例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;
}
}
示例4: log
private function log($message)
{
$logger = MOXMAN::getLogger();
if ($logger) {
MOXMAN::getLogger()->debug($message);
}
}
示例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);
}