Author: Nicolas Ruflin (spam@ruflin.com)
Inheritance: extends Psr\Log\AbstractLogger
コード例 #1
0
ファイル: LogTest.php プロジェクト: kskod/Elastica
 public function testGetLastMessage2()
 {
     $client = new Client(array('log' => true));
     $log = new Log($client);
     // Set log path temp path as otherwise test fails with output
     $errorLog = ini_get('error_log');
     ini_set('error_log', sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php.log');
     $message = 'hello world';
     $log->log($message);
     ini_set('error_log', $errorLog);
     $this->assertEquals($message, $log->getLastMessage());
 }
コード例 #2
0
 /**
  * @group unit
  */
 public function testGetLastMessage2()
 {
     $client = $this->_getClient(array('log' => true));
     $log = new Log($client);
     // Set log path temp path as otherwise test fails with output
     $errorLog = ini_get('error_log');
     ini_set('error_log', sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php.log');
     $this->_context['error_message'] = $this->_message;
     $message = json_encode($this->_context);
     $log->log(LogLevel::DEBUG, $this->_message, $this->_context);
     ini_set('error_log', $errorLog);
     $this->assertEquals($message, $log->getLastMessage());
 }
コード例 #3
0
ファイル: Client.php プロジェクト: kskod/Elastica
 /**
  * @param string|\Elastica\Request $message
  */
 protected function _log($message)
 {
     if ($this->getConfig('log')) {
         $log = new Log($this->getConfig('log'));
         $log->log($message);
     }
 }