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


PHP CakeLog::disable方法代码示例

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


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

示例1: 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

示例2: setUp

 /**
  * setup create a request object to get out of router later.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET);
     Router::reload();
     $request = new CakeRequest(null, false);
     $request->base = '';
     Router::setRequestInfo($request);
     Configure::write('debug', 2);
     CakeLog::disable('stdout');
     CakeLog::disable('stderr');
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:17,代码来源:ErrorHandlerTest.php

示例3: 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

示例4: testStreamDisableInvalid

 /**
  * test disable invalid stream
  *
  * @expectedException CakeLogException
  * @return void
  */
 public function testStreamDisableInvalid()
 {
     CakeLog::disable('bogus_stream');
 }
开发者ID:yuuicchan0912,项目名称:sample1,代码行数:10,代码来源:CakeLogTest.php

示例5: testExecutePriorities

 /**
  * Tests you can set priorities on the jobs to be run
  *
  * @return void
  **/
 public function testExecutePriorities()
 {
     CakeLog::disable('stderr');
     Configure::write('Gearman.prefix', 'test');
     $client = $this->getMock('GearmanClient', array('doLowBackground', 'doHighBackground'));
     GearmanQueue::client($client);
     $client->expects($this->any())->method('returnCode')->will($this->returnValue(GEARMAN_SUCCESS));
     $client->expects($this->at(0))->method('doLowBackground')->with('test_foo', json_encode('data'))->will($this->returnValue(GEARMAN_SUCCESS));
     $client->expects($this->at(1))->method('doHighBackground')->with('test_foo', json_encode('data'))->will($this->returnValue(GEARMAN_SUCCESS));
     GearmanQueue::execute('foo', 'data', 'low');
     GearmanQueue::execute('foo', 'data', 'high');
 }
开发者ID:lorenzo,项目名称:cakephp-gearman,代码行数:17,代码来源:GearmanQueueTest.php

示例6: testFileAndConsoleLogging

 /**
  * Test file and console and logging
  *
  * @return void
  */
 public function testFileAndConsoleLogging()
 {
     CakeLog::disable('stdout');
     CakeLog::disable('stderr');
     // file logging
     $this->Shell->log_something();
     $this->assertTrue(file_exists(LOGS . 'error.log'));
     unlink(LOGS . 'error.log');
     $this->assertFalse(file_exists(LOGS . 'error.log'));
     // both file and console logging
     require_once CORE_TEST_CASES . DS . 'Log' . DS . 'Engine' . DS . 'ConsoleLogTest.php';
     $mock = $this->getMock('ConsoleLog', array('write'), array(array('types' => 'error')));
     TestCakeLog::config('console', array('engine' => 'Console', 'stream' => 'php://stderr'));
     TestCakeLog::replace('console', $mock);
     $mock->expects($this->once())->method('write')->with('error', $this->Shell->testMessage);
     $this->Shell->log_something();
     $this->assertTrue(file_exists(LOGS . 'error.log'));
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertContains($this->Shell->testMessage, $contents);
     CakeLog::enable('stdout');
     CakeLog::enable('stderr');
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:27,代码来源:ShellTest.php


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