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


PHP Terminus::getLogger方法代码示例

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


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

示例1: __construct

 /**
  * Instantiates object, sets cache and session
  *
  * @return [TerminusCommand] $this
  */
 public function __construct()
 {
     //Load commonly used data from cache
     $this->cache = Terminus::getCache();
     $this->logger = Terminus::getLogger();
     $this->outputter = Terminus::getOutputter();
     $this->session = Session::instance();
     if (!Terminus::isTest()) {
         $this->checkForUpdate();
     }
 }
开发者ID:andrefy,项目名称:cli,代码行数:16,代码来源:class-terminus-command.php

示例2: testSetLogger

 public function testSetLogger()
 {
     // This test assumes that the debug output defaults to off.
     $file_name = getLogFileName();
     $message = 'The sky is the daily bread of the eyes.';
     setOutputDestination($file_name);
     Terminus::getLogger()->debug($message);
     $output = retrieveOutput($file_name);
     $this->assertFalse(strpos($output, $message) !== false);
     Terminus::setLogger(['debug' => true, 'format' => 'json']);
     Terminus::getLogger()->debug($message);
     $output = retrieveOutput($file_name);
     $this->assertTrue(strpos($output, $message) !== false);
     resetOutputDestination($file_name);
 }
开发者ID:dalin-,项目名称:cli,代码行数:15,代码来源:test-terminus.php

示例3: invalidPositionals

 /**
  * Returns invalid positionals, if any. False if not.
  *
  * @param array $args The arguments to evaluate for invalid positionals
  * @return string|bool Returns the first invalid positional or false
  */
 public function invalidPositionals($args)
 {
     $positionals = $this->querySpec(array('type' => 'positional'));
     $args_count = count($args);
     for ($i = 0; $i < $args_count; $i++) {
         if (!isset($positionals[$i]['token'])) {
             continue;
         }
         $token = preg_replace('#\\[?\\<([a-zA-Z].*)\\>\\]?.*#s', '$1', $positionals[$i]['token']);
         if (in_array(trim($token), array('commands', 'email'))) {
             // We exit here because the wp and drush commands need to not have
             // validation running since their commands are dependent on their
             // respective code bases.
             return false;
         }
         $regex = "#^({$token})\$#s";
         \Terminus::getLogger()->debug("Positional match {$regex}");
         if (!preg_match($regex, $args[$i])) {
             return $args[$i];
         }
     }
     return false;
 }
开发者ID:serundeputy,项目名称:cli,代码行数:29,代码来源:SynopsisValidator.php

示例4: writeAliases

 /**
  * Retrieves and writes Pantheon aliases to a file
  *
  * @param string $location Name of the file to which to write aliases
  * @return bool
  */
 private function writeAliases($location)
 {
     $logger = Terminus::getLogger();
     if (is_dir($location)) {
         $message = 'Please provide a full path with filename,';
         $message .= ' e.g. {location}/pantheon.aliases.drushrc.php';
         $logger->error($message, compact('location'));
     }
     $file_exists = file_exists($location);
     // Create the directory if it doesn't yet exist
     $dirname = dirname($location);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0700, true);
     }
     $content = $this->getAliases();
     $handle = fopen($location, 'w+');
     fwrite($handle, $content);
     fclose($handle);
     chmod($location, 0700);
     $message = 'Pantheon aliases created';
     if ($file_exists) {
         $message = 'Pantheon aliases updated';
     }
     $logger->info($message);
 }
开发者ID:pantheon-systems,项目名称:terminus,代码行数:31,代码来源:PantheonAliases.php

示例5: simpleRequest

 /**
  * Simplified request method for Pantheon API
  *
  * @param [string] $path    API path (URL)
  * @param [array]  $options Options for the request
  *   [string] method GET is default
  *   [mixed]  data   Native PHP data structure (e.g. int, string array, or
  *     simple object) to be sent along with the request. Will be encoded as
  *     JSON for you.
  * @return [array] $data
  */
 public static function simpleRequest($path, $options = array())
 {
     $method = 'get';
     if (isset($options['method'])) {
         $method = $options['method'];
         unset($options['method']);
     }
     $url = sprintf('%s://%s:%s/api/%s', TERMINUS_PROTOCOL, TERMINUS_HOST, TERMINUS_PORT, $path);
     if (Session::getValue('session')) {
         $options['cookies'] = array('X-Pantheon-Session' => Session::getValue('session'));
     }
     try {
         Terminus::getLogger()->debug('URL: {url}', compact('url'));
         $resp = Request::send($url, $method, $options);
     } catch (Guzzle\Http\Exception\BadResponseException $e) {
         throw new TerminusException('API Request Error: {msg}', array('msg' => $e->getMessage()));
     }
     $json = $resp->getBody(true);
     $data = array('info' => $resp->getInfo(), 'headers' => $resp->getRawHeaders(), 'json' => $json, 'data' => json_decode($json), 'status_code' => $resp->getStatusCode());
     return $data;
 }
开发者ID:blueprintmrk,项目名称:cli,代码行数:32,代码来源:class-terminus-command.php


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