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


PHP getLogger函数代码示例

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


在下文中一共展示了getLogger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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