本文整理汇总了PHP中getLogger函数的典型用法代码示例。如果您正苦于以下问题:PHP getLogger函数的具体用法?PHP getLogger怎么用?PHP getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: logInWithBehatCredentials
/**
* Logs in with Behad credentials to enable Behat fixture use
*
* @return void
*/
function logInWithBehatCredentials()
{
$creds = getBehatCredentials();
$options = ['logger' => getLogger()];
$auth = new AuthHelper($options);
$auth->logInViaUsernameAndPassword($creds['username'], $creds['password']);
}
开发者ID:karudonaldson,项目名称:terminus,代码行数:12,代码来源:bootstrap.php
示例2: raise
public static function raise($exception)
{
getLogger()->warn($exception->getMessage());
$class = get_class($exception);
$baseController = new BaseController();
switch ($class) {
case 'OPAuthorizationException':
case 'OPAuthorizationSessionException':
if (isset($_GET['__route__']) && substr($_GET['__route__'], -5) == '.json') {
echo json_encode($baseController->forbidden('You do not have sufficient permissions to access this page.'));
} else {
getRoute()->run('/error/403', EpiRoute::httpGet);
}
die;
break;
case 'OPAuthorizationOAuthException':
echo json_encode($baseController->forbidden($exception->getMessage()));
die;
break;
default:
getLogger()->warn(sprintf('Uncaught exception (%s:%s): %s', $exception->getFile(), $exception->getLine(), $exception->getMessage()));
throw $exception;
break;
}
}
开发者ID:gg1977,项目名称:frontend,代码行数:25,代码来源:exceptions.php
示例3: mysql_1_3_0
function mysql_1_3_0($sql, $params = array())
{
try {
getDatabase()->execute($sql, $params);
getLogger()->info($sql);
} catch (Exception $e) {
getLogger()->crit($e->getMessage());
}
}
开发者ID:gg1977,项目名称:frontend,代码行数:9,代码来源:mysql-1.3.0.php
示例4: subscribe
/**
* Subscribe to a topic (creates a webhook).
*
* @return void
*/
public function subscribe()
{
getAuthentication()->requireAuthentication();
$params = $_POST;
$params['verify'] = 'sync';
if (isset($params['callback']) && isset($params['mode']) && isset($params['topic'])) {
$urlParts = parse_url($params['callback']);
if (isset($urlParts['scheme']) && isset($urlParts['host'])) {
if (!isset($urlParts['port'])) {
$port = '';
}
if (!isset($urlParts['path'])) {
$path = '';
}
extract($urlParts);
$challenge = uniqid();
$queryParams = array();
if (isset($urlParts['query']) && !empty($urlParts['query'])) {
parse_str($urlParts['query'], $queryParams);
}
$queryParams['mode'] = $params['mode'];
$queryParams['topic'] = $params['topic'];
$queryParams['challenge'] = $challenge;
if (isset($params['verifyToken'])) {
$queryParams['verifyToken'] = $params['verifyToken'];
}
$queryString = '';
if (!empty($queryParams)) {
$queryString = sprintf('?%s', http_build_query($queryParams));
}
$url = sprintf('%s://%s%s%s%s', $scheme, $host, $port, $path, $queryString);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$handle = getCurl()->addCurl($ch);
// verify a 2xx response and that the body is equal to the challenge
if ($handle->code >= 200 && $handle->code < 300 && $handle->data == $challenge) {
$apiWebhook = $this->api->invoke('/webhook/create.json', EpiRoute::httpPost, array('_POST' => $params));
if ($apiWebhook['code'] === 200) {
header('HTTP/1.1 204 No Content');
getLogger()->info(sprintf('Webhook successfully created: %s', json_encode($params)));
return;
}
}
$message = sprintf('The verification call failed to meet requirements. Code: %d, Response: %s, Expected: %s, URL: %s', $handle->code, $handle->data, $challenge, $url);
getLogger()->warn($message);
} else {
$message = sprintf('Callback url was invalid: %s', $params['callback']);
getLogger()->warn($message);
}
} else {
$message = sprintf('Not all required parameters were passed in to webhook subscribe: %s', json_encode($params));
getLogger()->warn($message);
}
header('HTTP/1.1 400 Bad Request');
echo $message;
}
开发者ID:gg1977,项目名称:frontend,代码行数:61,代码来源:WebhookController.php
示例5: remove
public function remove()
{
$logger = getLogger();
$input = JFactory::getApplication()->input;
$ids = $input->post->get('cid', array(), 'array');
JArrayHelper::toInteger($ids);
$model = $this->getModel('whitelist');
$message = $model->remove($ids, $logger);
$this->setRedirect(JRoute::_('index.php?option=com_bfstop&view=whitelist', false), $message, 'notice');
}
开发者ID:sumithMadhushan,项目名称:joomla-project,代码行数:10,代码来源:whitelist.php
示例6: mysql_3_0_6
function mysql_3_0_6($sql, $params = array())
{
try {
getDatabase()->execute($sql, $params);
getLogger()->info($sql);
} catch (Exception $e) {
getLogger()->crit($e->getMessage());
return false;
}
return true;
}
开发者ID:gg1977,项目名称:frontend,代码行数:11,代码来源:mysql-3.0.6.php
示例7: createPost
private function createPost($photo)
{
$conf = $this->getConf();
$this->adn->setAccessToken($conf->accessToken);
$data = array('annotations' => array(array('type' => 'net.app.core.oembed', 'value' => array('type' => 'photo', 'version' => '1.0', 'url' => $photo['pathBase'], 'width' => $photo['width'], 'height' => $photo['height'], 'provider_url' => 'https://trovebox.com', 'thumbnail_url' => $photo['path100x100xCR'], 'thumbnail_width' => 100, 'thumbnail_height' => 100))));
try {
$this->adn->createPost(sprintf('I just posted a new photo. %s', $photo['url']), $data);
} catch (AppDotNetException $e) {
getLogger()->warn('Could not create ADN post update.', $e);
}
}
开发者ID:gg1977,项目名称:frontend,代码行数:11,代码来源:AppDotNetAutoPostPlugin.php
示例8: testCheckForUpdate
/**
* @vcr utils#checkCurrentVersion
*/
public function testCheckForUpdate()
{
$log_file = getLogFileName();
setOutputDestination($log_file);
$cache = new FileCache();
$cache->putData('latest_release', ['check_date' => strtotime('8 days ago')]);
Utils\checkForUpdate(getLogger());
$file_contents = explode("\n", file_get_contents($log_file));
$this->assertFalse(strpos(array_pop($file_contents), 'An update to Terminus is available.'));
resetOutputDestination($log_file);
}
开发者ID:sammys,项目名称:terminus,代码行数:14,代码来源:test-utils.php
示例9: __construct
public function __construct()
{
$this->api = getApi();
$this->config = getConfig()->get();
$this->logger = getLogger();
$this->route = getRoute();
$this->session = getSession();
$this->cache = getCache();
// really just for setup when the systems don't yet exist
if (isset($this->config->systems)) {
$this->db = getDb();
$this->fs = getFs();
}
}
开发者ID:nicolargo,项目名称:frontend,代码行数:14,代码来源:BaseModel.php
示例10: verifyEmail
public function verifyEmail($args)
{
if (!$this->isActive) {
getLogger()->crit('The FacebookConnect plugin is not active and needs to be for the Facebook Login adapter.');
return false;
}
$user = $this->fb->getUser();
if (!$user) {
return false;
}
$response = $this->fb->api('/me');
if (!isset($response['email'])) {
return false;
}
return $response['email'];
}
开发者ID:nicolargo,项目名称:frontend,代码行数:16,代码来源:LoginFacebook.php
示例11: display
function display($tpl = null)
{
// clear the messages still enqueued from the invalid login attempt:
$session = JFactory::getSession();
$session->set('application.queue', null);
// try to unblock:
$input = JFactory::getApplication()->input;
$token = $input->getString('token', '');
$logger = getLogger();
if (strcmp($token, '') != 0) {
$this->model = $this->getModel();
$unblockSuccess = $this->model->unblock($token, $logger);
$this->message = $unblockSuccess ? JText::sprintf('UNBLOCKTOKEN_SUCCESS', $this->getLoginLink(), $this->getPasswordResetLink()) : JText::_('UNBLOCKTOKEN_FAILED');
} else {
$this->message = JText::_('UNBLOCKTOKEN_INVALID');
}
parent::display($tpl);
}
开发者ID:sumithMadhushan,项目名称:joomla-project,代码行数:18,代码来源:view.html.php
示例12: testNotify
public function testNotify()
{
$emailAddress = $this->getParam('emailaddress', 'params', '');
$userID = (int) $this->getParam('userID', 'params', -1);
$userGroup = (int) $this->getParam('userGroup', 'params', -1);
$groupNotifEnabled = (bool) $this->getParam('groupNotificationEnabled', 'params', false);
$logger = getLogger();
$db = new BFStopDBHelper($logger);
$notifier = new BFStopNotifier($logger, $db, $emailAddress, $userID, $userGroup, $groupNotifEnabled);
if (count($notifier->getNotifyAddresses()) == 0) {
$result = false;
} else {
$subject = JText::sprintf('TEST_MAIL_SUBJECT', $notifier->getSiteName());
$body = JText::sprintf('TEST_MAIL_BODY', $notifier->getSiteName());
$application = JFactory::getApplication();
$application->enqueueMessage(JText::sprintf("TEST_MAIL_SENT", $subject, $body, implode(", ", $notifier->getNotifyAddresses())), 'notice');
$result = $notifier->sendMail($subject, $body, $notifier->getNotifyAddresses());
}
// redirect back to settings view:
$this->setRedirect(JRoute::_('index.php?option=com_bfstop&view=settings', false), $result ? JText::_('TEST_NOTIFICATION_SUCCESS') : JText::_('TEST_NOTIFICATION_FAILED'), $result ? 'notice' : 'error');
}
开发者ID:sumithMadhushan,项目名称:joomla-project,代码行数:21,代码来源:settings.php
示例13: initLogger
function initLogger()
{
$loggerName = "log";
// Iterate over all declared classes
$classes = get_declared_classes();
foreach ($classes as $class) {
$reflection = new ReflectionClass($class);
// If the class is internally defined by PHP or has no property called "logger", skip it.
if ($reflection->isInternal() || !$reflection->hasProperty($loggerName)) {
continue;
}
// Get information regarding the "logger" property of this class.
$property = new ReflectionProperty($class, $loggerName);
// If the "logger" property is not static or not public, then it is not the one we are interested in. Skip this class.
if (!$property->isStatic() || !$property->isPublic()) {
continue;
}
// Initialize the logger for this class.
$reflection->setStaticPropertyValue($loggerName, getLogger());
}
}
开发者ID:vladikius,项目名称:tephlon,代码行数:21,代码来源:AELogger.php
示例14: __construct
public function __construct()
{
$this->api = getApi();
$this->config = getConfig()->get();
$this->plugin = getPlugin();
$this->route = getRoute();
$this->session = getSession();
$this->logger = getLogger();
$this->template = getTemplate();
$this->theme = getTheme();
$this->utility = new Utility();
$this->url = new Url();
$this->template->template = $this->template;
$this->template->config = $this->config;
$this->template->plugin = $this->plugin;
$this->template->session = $this->session;
$this->template->theme = $this->theme;
$this->template->utility = $this->utility;
$this->template->url = $this->url;
$this->template->user = new User();
$this->apiVersion = Request::getApiVersion();
}
开发者ID:gg1977,项目名称:frontend,代码行数:22,代码来源:ApiBaseController.php
示例15: getImage
/**
* The public interface for instantiating an image obect.
* This returns the appropriate type of object by reading the config.
* Accepts a set of params that must include a type and targetType
*
* @return object An image object that implements ImageInterface
*/
function getImage()
{
static $type;
$modules = getConfig()->get('modules');
if (!$type && isset($modules->image)) {
$type = $modules->image;
}
try {
switch ($type) {
case 'GraphicsMagick':
return new ImageGraphicsMagick();
break;
case 'ImageMagick':
return new ImageImageMagick();
break;
case 'GD':
return new ImageGD();
break;
}
} catch (OPInvalidImageException $e) {
getLogger()->warn("Invalid image exception thrown for {$type}");
return false;
}
}
开发者ID:nicolargo,项目名称:frontend,代码行数:31,代码来源:Image.php
示例16: __construct
/**
* Object constructor
*
* @access public
*
* @param string $description Error description
* @param int $stop Stop (0 - stop script execution, 1 - show warning and continue script execution)
* @param int $short Short (default 0)
* @return void
*/
public function __construct($description, $stop = 0, $short = 0)
{
$script = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$description = $script . "\nError:\n" . $description;
$log = getLogger();
$log->error($description);
if (defined("DEBUG_MODE")) {
if (!$short) {
$this->alert(nl2br($description));
} else {
echo nl2br($description);
}
} else {
if (!$short) {
$this->alert("");
} else {
echo "Warning...<br>";
}
}
sendmail("errors@" . PROJECT_DOMAIN, PROJECT_BUGTRACK, "Error reporting: {$script}", $description);
if ($stop) {
exit;
}
}
开发者ID:cdkisa,项目名称:majordomo,代码行数:34,代码来源:errors.class.php
示例17: flow
public function flow()
{
if (isset($_GET['oauth_token'])) {
$consumerKey = $_GET['oauth_consumer_key'];
$consumerSecret = $_GET['oauth_consumer_secret'];
$token = $_GET['oauth_token'];
$tokenSecret = $_GET['oauth_token_secret'];
$verifier = $_GET['oauth_verifier'];
try {
$consumer = getDb()->getCredential($token);
$oauth = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setVersion('1.0a');
$oauth->setToken($token, $tokenSecret);
$accessToken = $oauth->getAccessToken(sprintf('%s://%s/v1/oauth/token/access', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST']), null, $verifier);
$accessToken['oauth_consumer_key'] = $consumerKey;
$accessToken['oauth_consumer_secret'] = $consumerSecret;
setcookie('oauth', http_build_query($accessToken));
if (!isset($accessToken['oauth_token']) || !isset($accessToken['oauth_token_secret'])) {
echo sprintf('Invalid response when getting an access token: %s', http_build_query($accessToken));
} else {
echo sprintf('You exchanged a request token for an access token<br><a href="?reloaded=1">Reload to make an OAuth request</a>', $accessToken['oauth_token'], $accessToken['oauth_token_secret']);
}
} catch (OAuthException $e) {
$message = OAuthProvider::reportProblem($e);
getLogger()->info($message);
OPException::raise(new OPAuthorizationOAuthException($message));
}
} else {
if (!isset($_GET['reloaded'])) {
$callback = sprintf('%s://%s/v1/oauth/flow', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST']);
$name = isset($_GET['name']) ? $_GET['name'] : 'OAuth Test Flow';
echo sprintf('<a href="%s://%s/v1/oauth/authorize?oauth_callback=%s&name=%s">Create a new client id</a>', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], urlencode($callback), urlencode($name));
} else {
try {
parse_str($_COOKIE['oauth']);
$consumer = getDb()->getCredential($oauth_token);
$oauth = new OAuth($oauth_consumer_key, $oauth_consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setToken($oauth_token, $oauth_token_secret);
$oauth->fetch(sprintf('http://%s/v1/oauth/test?oauth_consumer_key=%s', $_SERVER['HTTP_HOST'], $oauth_consumer_key));
$response_info = $oauth->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $oauth->getLastResponse();
} catch (OAuthException $e) {
$message = OAuthProvider::reportProblem($e);
getLogger()->info($message);
OPException::raise(new OPAuthorizationOAuthException($message));
}
}
}
}
开发者ID:nicolargo,项目名称:frontend,代码行数:50,代码来源:OAuthController.php
示例18: initialize
/**
* Initialize the database by creating the database and tables needed.
* This is called from the Setup controller.
*
* @return boolean
*/
public function initialize($isEditMode)
{
$version = $this->version();
// we're not running setup for the first time and we're not in edit mode
if ($version !== '0.0.0' && $isEditMode === false) {
// email address has to be unique
// getting a null back from getUser() means we can proceed
$user = true;
if ($this->owner != '') {
$user = $this->getUser($this->owner);
}
// getUser returns null if the user does not exist
if ($user === null) {
return true;
}
getLogger()->crit(sprintf('Could not initialize user for MySql due to email conflict (%s).', $this->owner));
return false;
} elseif ($version === '0.0.0') {
try {
return $this->executeScript(sprintf('%s/upgrade/db/mysql/mysql-base.php', getConfig()->get('paths')->configs), 'mysql');
} catch (EpiDatabaseException $e) {
getLogger()->crit($e->getMessage());
return false;
}
}
return true;
}
开发者ID:jjdelc,项目名称:frontend,代码行数:33,代码来源:DatabaseMySql.php
示例19: writeConfigFile
/**
* Write out the settings config file
*
* @return boolean TRUE on success, FALSE on error
*/
private function writeConfigFile()
{
// continue if no errors
$secret = $this->getSecret();
$baseDir = $this->utility->getBaseDir();
$htmlDir = "{$baseDir}/html";
$libDir = "{$baseDir}/libraries";
$configDir = "{$baseDir}/configs";
$replacements = array('{adapters}' => "{$libDir}/adapters", '{configs}' => $configDir, '{controllers}' => "{$libDir}/controllers", '{docroot}' => "{$htmlDir}", '{external}' => "{$libDir}/external", '{libraries}' => "{$libDir}", '{models}' => "{$libDir}/models", '{photos}' => "{$htmlDir}/photos", '{plugins}' => "{$libDir}/plugins", '{templates}' => "{$baseDir}/templates", '{themes}' => "{$htmlDir}/assets/themes", '{temp}' => sys_get_temp_dir(), '{userdata}' => "{$baseDir}/userdata", '{exiftran}' => exec('which exiftran'), '{autoTagWithDate}' => '1', '{localSecret}' => $secret, '{awsKey}' => "", '{awsSecret}' => "", '{s3Bucket}' => getSession()->get('s3BucketName'), '{s3Host}' => getSession()->get('s3BucketName') . '.s3.amazonaws.com', '{mySqlHost}' => "", '{mySqlUser}' => "", '{mySqlPassword}' => "", '{mySqlDb}' => "", '{mySqlTablePrefix}' => "", '{dropboxKey}' => "", '{dropboxSecret}' => "", '{dropboxToken}' => "", '{dropboxTokenSecret}' => "", '{dropboxFolder}' => "", '{fsRoot}' => "", '{fsHost}' => "", '{lastCodeVersion}' => getConfig()->get('defaults')->currentCodeVersion, '{theme}' => getSession()->get('theme'), '{email}' => getSession()->get('ownerEmail'));
// Session keys whose value it is ok to log.
// Other session keys available at this point are:
// awsKey, awsSecret, dropboxKey, dropboxSecret, dropboxToken, dropboxTokenSecret,
// flowDropboxKey, flowDropboxSecret, mySqlPassword, mySqlUser, password, secret, step
// It is safer to explicitly list keys that are ok to log, rather than exclude those that are
// sensitive, as one might forget to exclude new keys.
$settingsToLog = array('step', 'appId', 'ownerEmail', 'isEditMode', 'theme', 'imageLibrary', 'database', 'mySqlDb', 'mySqlHost', 'mySqlTablePrefix', 'fileSystem', 'fsHost', 'fsRoot', 'dropboxFolder', 'flowDropboxFolder', 's3BucketName');
$pReplace = array();
$session = getSession()->getAll();
foreach ($session as $key => $val) {
if ($key != 'email' && $key != 'password') {
$pReplace["{{$key}}"] = $val;
}
// Write keys to the log file. If key is in whitelist then log the value as well.
if (in_array($key, $settingsToLog)) {
$logMessage = sprintf("Storing `%s` as '%s'", $key, $val);
} else {
$logMessage = sprintf("Storing `%s`", $key);
}
getLogger()->info($logMessage);
}
$replacements = array_merge($replacements, $pReplace);
$generatedIni = str_replace(array_keys($replacements), array_values($replacements), file_get_contents("{$configDir}/template.ini"));
$iniWritten = getConfig()->write(sprintf("%s/userdata/configs/%s.ini", $baseDir, getenv('HTTP_HOST')), $generatedIni);
if (!$iniWritten) {
return false;
}
// clean up the session
foreach ($session as $key => $val) {
if ($key != 'email') {
getSession()->set($key, '');
}
}
return true;
}
开发者ID:gg1977,项目名称:frontend,代码行数:49,代码来源:SetupController.php
示例20: putFileInDirectory
private function putFileInDirectory($directory, $localFile, $destinationName)
{
$createDirectory = false;
$destinationDirectory = sprintf('%s/%s', $this->dropboxFolder, $directory);
try {
$this->dropbox->getMetaData($destinationDirectory);
if (isset($queryDropboxFolder['is_deleted']) && $queryDropboxFolder['is_deleted'] == 1) {
$createDirectory = true;
}
} catch (Dropbox_Exception_NotFound $e) {
$createDirectory = true;
} catch (Exception $e) {
getLogger()->warn('Dropbox exception from getMetaData call', $e);
return false;
}
if ($createDirectory) {
try {
getLogger()->info(sprintf('Creating dropbox directory %s', $destinationDirectory));
$this->dropbox->createFolder($destinationDirectory);
} catch (Dropbox_Exception $e) {
getLogger()->info('Failed creating dropbox directory.', $e);
return false;
}
}
try {
$this->dropbox->putFile(sprintf('%s/%s', $destinationDirectory, $destinationName), $localFile);
getLogger()->info(sprintf('Successfully stored file (%s) on dropbox.', $destinationName));
return true;
} catch (Dropbox_Exception $e) {
getLogger()->crit('Could not put file on dropbox.', $e);
}
return false;
}
开发者ID:gg1977,项目名称:frontend,代码行数:33,代码来源:FileSystemDropboxBase.php
注:本文中的getLogger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论