本文整理汇总了PHP中Logging::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::getLogger方法的具体用法?PHP Logging::getLogger怎么用?PHP Logging::getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::getLogger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enablePropelLogging
public static function enablePropelLogging()
{
$logger = Logging::getLogger();
Propel::setLogger($logger);
$con = Propel::getConnection();
$con->useDebug(true);
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
$config->setParameter('debugpdo.logging.details.method.enabled', true);
$config->setParameter('debugpdo.logging.details.time.enabled', true);
$config->setParameter('debugpdo.logging.details.mem.enabled', true);
}
示例2: getMediaAction
/**
* Allows remote client to download requested media file.
*
* @return void
*
*/
public function getMediaAction()
{
global $CC_CONFIG;
// disable the view and the layout
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
$download = "true" == $this->_getParam('download');
$logger = Logging::getLogger();
if (!in_array($api_key, $CC_CONFIG["apiKey"]) && is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
$logger->info("401 Unauthorized");
return;
}
$filename = $this->_getParam("file");
$file_id = substr($filename, 0, strpos($filename, "."));
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
$media = StoredFile::RecallByGunid($file_id);
if ($media != null && !PEAR::isError($media)) {
$filepath = $media->getFilePath();
if (is_file($filepath)) {
// possibly use fileinfo module here in the future.
// http://www.php.net/manual/en/book.fileinfo.php
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if ($ext == "ogg") {
header("Content-Type: audio/ogg");
} else {
if ($ext == "mp3") {
header("Content-Type: audio/mpeg");
}
}
if ($download) {
//path_info breaks up a file path into seperate pieces of informaiton.
//We just want the basename which is the file name with the path
//information stripped away. We are using Content-Disposition to specify
//to the browser what name the file should be saved as.
//
// By james.moon:
// I'm removing pathinfo() since it strips away UTF-8 characters.
// Using manualy parsing
$full_path = $media->getPropelOrm()->getDbFilepath();
$file_base_name = strrchr($full_path, '/');
$file_base_name = substr($file_base_name, 1);
header('Content-Disposition: attachment; filename="' . $file_base_name . '"');
}
header("Content-Length: " . filesize($filepath));
// !! binary mode !!
$fp = fopen($filepath, 'rb');
//We can have multiple levels of output buffering. Need to
//keep looping until all have been disabled!!!
//http://www.php.net/manual/en/function.ob-end-flush.php
while (@ob_end_flush()) {
}
fpassthru($fp);
fclose($fp);
//make sure to exit here so that no other output is sent.
exit;
} else {
$logger->err('Resource in database, but not in storage: "' . $filepath . '"');
}
} else {
$logger->err('$media != null && !PEAR::isError($media)');
}
} else {
$logger->err('ctype_alnum($file_id) && strlen($file_id) == 32');
}
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
$logger->info("404 Not Found");
return;
}