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


PHP Slim::getLog方法代码示例

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


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

示例1: init

 /**
  * Configures Honeybadger for the supplied Slim app for exception catching.
  *
  * @param   Slim    $app      The Slim app.
  * @param   array   $options  The config options.
  * @return  Config  The Honeybadger configuration.
  */
 protected static function init(\Slim\Slim $app, array $options = array())
 {
     if ($logger = $app->getLog()) {
         // Wrap the application logger.
         Honeybadger::$logger = new \Honeybadger\Logger\Slim($app->getLog());
     }
     // Add missing, detected options.
     $options = Arr::merge(array('environment_name' => $app->getMode(), 'framework' => sprintf('Slim: %s', \Slim\Slim::VERSION)), $options);
     // Create a new configuration with the merged options.
     Honeybadger::$config = new Config(Honeybadger::$config->merge($options));
 }
开发者ID:onpaws,项目名称:honeybadger-php,代码行数:18,代码来源:Slim.php

示例2: __construct

 public function __construct(Slim $slim)
 {
     $this->slim = $slim;
     if ($log = $slim->getLog()) {
         $this->originalLogWriter = $log->getWriter();
         $log->setWriter($this);
         $log->setEnabled(true);
     }
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:9,代码来源:SlimCollector.php

示例3: _handleEndpointCall

 /**
  * @param object $endpoint
  * @param string $type
  * @param array  $params
  *
  * @throws Slim\Exception\Stop
  */
 private function _handleEndpointCall($endpoint, $type, array $params)
 {
     if ($endpoint instanceof SlimBootstrap\Endpoint\InjectClientId) {
         $endpoint->setClientId($this->_app->router()->getCurrentRoute()->getParam('clientId'));
     }
     try {
         $outputWriter =& $this->_hook->getResponseOutputWriter();
         if ($endpoint instanceof SlimBootstrap\Endpoint\ForceDefaultMimeType) {
             $csvConfig = array();
             if (true === \array_key_exists('csv', $this->_applicationConfig) && true === \is_array($this->_applicationConfig['csv'])) {
                 $csvConfig = $this->_applicationConfig['csv'];
             }
             // create output writer
             $responseOutputWriterFactory = new SlimBootstrap\ResponseOutputWriter\Factory($this->_app->request, $this->_app->response, $this->_app->response->headers, $this->_applicationConfig['shortName'], $csvConfig);
             $outputWriter = $responseOutputWriterFactory->create($endpoint->getDefaultMimeType());
         }
         if ($endpoint instanceof SlimBootstrap\Endpoint\Streamable) {
             if ($outputWriter instanceof SlimBootstrap\ResponseOutputWriterStreamable) {
                 $endpoint->setOutputWriter($outputWriter);
                 \ob_start();
                 $endpoint->{$type}($params, $this->_app->request->{$type}());
                 \ob_end_clean();
             } else {
                 throw new SlimBootstrap\Exception('media type does not support streaming', 406, Slim\Log::WARN);
             }
         } else {
             $data = $endpoint->{$type}($params, $this->_app->request->{$type}());
             if ($endpoint instanceof SlimBootstrap\Endpoint\PlainData) {
                 if ($outputWriter instanceof SlimBootstrap\ResponseOutputWriterPlainData) {
                     $outputWriter->writePlain($data);
                 } else {
                     throw new SlimBootstrap\Exception('media type does not support plain data writing', 406, Slim\Log::WARN);
                 }
             } else {
                 $outputWriter->write($data);
             }
         }
     } catch (SlimBootstrap\Exception $e) {
         $this->_app->getLog()->log($e->getLogLevel(), $e->getCode() . ' - ' . $e->getMessage());
         $this->_app->response->setStatus($e->getCode());
         $this->_app->response->setBody($e->getMessage());
         $this->_app->stop();
     }
 }
开发者ID:bigpoint,项目名称:slim-bootstrap,代码行数:51,代码来源:Bootstrap.php

示例4: responseStatus

 public function responseStatus()
 {
     $this->_app->etag(md5($this->_app->response->getBody()));
     $this->_app->getLog()->debug('Response status: ' . $this->_app->response->getStatus());
 }
开发者ID:bigpoint,项目名称:slim-bootstrap,代码行数:5,代码来源:Hook.php

示例5: function

});
$app->get('/page/:page', function ($page = 1) use($app, $container) {
    $images = $container['imageService']->findAll();
    $paginator = $container['pagination']->newPaginator($images, $page, 10);
    $home = $page == 1 ? true : false;
    $app->render('index.html', array('paginator' => $paginator, 'pages' => $paginator->getPages(), 'home' => $home));
});
$app->get('/day/:day', function ($day) use($app, $container) {
    $image = $container['imageService']->find($day);
    if (!$image) {
        $app->notFound();
    }
    $app->render('day.html', $image);
})->conditions(array('day' => '([1-9]\\d?|[12]\\d\\d|3[0-5]\\d|36[0-6])'));
$app->post('/admin/clear-cache', function () use($app, $container) {
    $log = $app->getLog();
    $cleared = null;
    $clear = $app->request()->post('clear');
    if ($clear == 1) {
        if ($container['cache']->flush()) {
            $app->flash('cacheSuccess', 'Cache cleared.');
        } else {
            $app->flash('cacheFailure', 'Problem clearing cache!');
            $log->error('Cache not cleared');
        }
    }
    $app->redirect('/admin/settings');
});
$app->get('/admin(/page/:page)', function ($page = 1) use($app, $container) {
    $images = $container['imageService']->findAll();
    $paginator = $container['pagination']->newPaginator($images, $page, 25);
开发者ID:neophyt3,项目名称:flaming-archer,代码行数:31,代码来源:index.php

示例6: Slim

<?php

/**
 * Listen for teamspeak server events.
 */
require './vendor/autoload.php';
use Slim\Slim;
use SlackTeamspeakIntegration\EventWorker;
$app = new Slim();
$app->config('debug', false);
$eventWorker = new EventWorker($app->getLog());
$eventWorker->run();
开发者ID:bastienwirtz,项目名称:SlackTsNotifier,代码行数:12,代码来源:app-cli.php

示例7: Slim

<?php

require '../vendor/autoload.php';
use Slim\Slim;
use SlackTeamspeakIntegration\SlackTsNotifier;
$app = new Slim();
$app->config('debug', false);
/**
 * List TeamSpeak connected clients for custom slack slash commands
 * @see https://api.slack.com/slash-commands
 */
$app->post('/clients', function () use($app) {
    $channel = $app->request->post('channel_name');
    $slackTsNotifier = new SlackTsNotifier($app->getLog(), $channel);
    $slackTsNotifier->sendUserList();
});
$app->run();
开发者ID:bastienwirtz,项目名称:SlackTsNotifier,代码行数:17,代码来源:app.php


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