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


PHP CakeLog::stream方法代码示例

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


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

示例1: testValidKeyName

 /**
  * test config() with valid key name
  *
  * @return void
  */
 public function testValidKeyName()
 {
     CakeLog::config('valid', array('engine' => 'FileLog'));
     $stream = CakeLog::stream('valid');
     $this->assertInstanceOf('FileLog', $stream);
     CakeLog::drop('valid');
 }
开发者ID:carriercomm,项目名称:professional-inventory-and-billing-system,代码行数:12,代码来源:CakeLogTest.php

示例2: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $class = $this->getMockClass('BaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error'), 'scopes' => ['gearman']));
     $this->logger = CakeLog::stream('queuetest');
     Configure::write('Gearman', array());
 }
开发者ID:lorenzo,项目名称:cakephp-gearman,代码行数:13,代码来源:GearmanQueueTest.php

示例3: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $class = $this->getMockClass('BaseLog', array('write'), array(), 'SQSBaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error', 'debug'), 'scopes' => array('sqs')));
     $this->logger = CakeLog::stream('queuetest');
     CakeLog::disable('stderr');
     Configure::write('SQS', array());
 }
开发者ID:dilab,项目名称:cakephp-sqs,代码行数:14,代码来源:SimpleQueueTest.php

示例4: setUp

 /**
  * Sets up a mocked logger stream
  *
  * @return void
  **/
 public function setUp()
 {
     parent::setUp();
     $this->_root = Nodes\Environment::getRoot();
     Nodes\Environment::setRoot('/var/www/test');
     $class = $this->getMockClass('BaseLog');
     CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error')));
     $this->logger = CakeLog::stream('queuetest');
 }
开发者ID:nodesagency,项目名称:Platform-Common-Plugin,代码行数:14,代码来源:GearmanQueueTest.php

示例5: testLog

 public function testLog()
 {
     $stream = CakeLog::stream('error');
     $engine = get_class($stream);
     $config = array_merge($stream->config(), compact('engine'));
     CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS)));
     $filepath = TMP . 'tests' . DS . 'error.log';
     if (file_exists($filepath)) {
         unlink($filepath);
     }
     $this->assertTrue($this->Model->log('Test warning 1'));
     $this->assertTrue($this->Model->log(array('Test' => 'warning 2')));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]);
     $this->assertRegExp('/^\\($/', $result[2]);
     $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]);
     $this->assertRegExp('/^\\)$/', $result[4]);
     unlink($filepath);
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING));
     $this->assertTrue($this->Model->log(array('Test' => 'warning 2'), LOG_WARNING));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]);
     $this->assertRegExp('/^\\($/', $result[2]);
     $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]);
     $this->assertRegExp('/^\\)$/', $result[4]);
     unlink($filepath);
     CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS, 'scopes' => array('some_scope'))));
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING));
     $this->assertTrue(!file_exists($filepath));
     $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING, 'some_scope'));
     $result = file($filepath);
     $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]);
     CakeLog::config('error', $config);
 }
开发者ID:gourmet,项目名称:common,代码行数:36,代码来源:CommonAppModelTest.php

示例6: testLogError

 /**
  * test LogError()
  *
  * @return void
  */
 public function testLogError()
 {
     @unlink(LOGS . 'error.log');
     // disable stderr output for this test
     if (CakeLog::stream('stderr')) {
         CakeLog::disable('stderr');
     }
     LogError('Testing LogError() basic function');
     LogError("Testing with\nmulti-line\nstring");
     if (CakeLog::stream('stderr')) {
         CakeLog::enable('stderr');
     }
     $result = file_get_contents(LOGS . 'error.log');
     $this->assertRegExp('/Error: Testing LogError\\(\\) basic function/', $result);
     $this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result);
     $this->assertRegExp('/Error: Testing with multi-line string/', $result);
 }
开发者ID:pritten,项目名称:SmartCitizen.me,代码行数:22,代码来源:BasicsTest.php

示例7: testProtectedUseLogger

 /**
  * Tests that _useLogger works properly
  *
  * @return void
  */
 public function testProtectedUseLogger()
 {
     CakeLog::drop('stdout');
     CakeLog::drop('stderr');
     $this->Shell->useLogger(true);
     $this->assertNotEmpty(CakeLog::stream('stdout'));
     $this->assertNotEmpty(CakeLog::stream('stderr'));
     $this->Shell->useLogger(false);
     $this->assertFalse(CakeLog::stream('stdout'));
     $this->assertFalse(CakeLog::stream('stderr'));
 }
开发者ID:hupla78,项目名称:Nadia,代码行数:16,代码来源:ShellTest.php

示例8: _restoresForSetup

 /**
  * Restore original scopes on all loggers
  */
 public function _restoresForSetup()
 {
     foreach (CakeLog::configured() as $name) {
         $logger = CakeLog::stream($name);
         if (!method_exists($logger, 'config')) {
             continue;
         }
         $config = $logger->config();
         if (!array_key_exists('scopes_backup', $config)) {
             continue;
         }
         $config['scopes'] = $config['scopes_backup'];
         unset($config['scopes_backup']);
         $logger->config($config);
     }
 }
开发者ID:beckye67,项目名称:Icing,代码行数:19,代码来源:AppFastFixture.php


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