Skip to content
Permalink
Browse files

Update syslog to use namespaces.

  • Loading branch information...
markstory committed May 24, 2013
1 parent 5290597 commit 8c57b0e4fc0e2fe956d8aef7f2da7e39b811314b
@@ -17,20 +17,19 @@
* @since CakePHP(tm) v 2.4
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Log\Engine;
App::uses('BaseLog', 'Log/Engine');
use Cake\Log\Engine\BaseLog;
/**
* Syslog stream for Logging. Writes logs to the system logger
*
* @package Cake.Log.Engine
*/
class SyslogLog extends BaseLog {
/**
*
* By default messages are formatted as:
* type: message
* type: message
*
* To override the log format (e.g. to add your own info) define the format key when configuring
* this logger
@@ -16,26 +16,26 @@
* @since CakePHP(tm) v 2.4
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('SyslogLog', 'Log/Engine');
namespace Cake\Test\TestCase\Log\Engine;
use Cake\TestSuite\TestCase;
/**
* SyslogLogTest class
*
* @package Cake.Test.Case.Log.Engine
*/
class SyslogLogTest extends CakeTestCase {
class SyslogLogTest extends TestCase {
/**
* Tests that the connection to the logger is open with the right arguments
*
* @return void
*/
public function testOpenLog() {
$log = $this->getMock('SyslogLog', array('_open', '_write'));
$log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write'));
$log->expects($this->once())->method('_open')->with('', LOG_ODELAY, LOG_USER);
$log->write('debug', 'message');
$log = $this->getMock('SyslogLog', array('_open', '_write'));
$log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write'));
$log->config(array(
'prefix' => 'thing',
'flag' => LOG_NDELAY,
@@ -54,7 +54,7 @@ public function testOpenLog() {
* @return void
*/
public function testWriteOneLine($type, $expected) {
$log = $this->getMock('SyslogLog', array('_open', '_write'));
$log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write'));
$log->expects($this->once())->method('_write')->with($expected, $type . ': Foo');
$log->write($type, 'Foo');
}
@@ -65,7 +65,7 @@ public function testWriteOneLine($type, $expected) {
* @return void
*/
public function testWriteMultiLine() {
$log = $this->getMock('SyslogLog', array('_open', '_write'));
$log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write'));
$log->expects($this->at(1))->method('_write')->with(LOG_DEBUG, 'debug: Foo');
$log->expects($this->at(2))->method('_write')->with(LOG_DEBUG, 'debug: Bar');
$log->expects($this->exactly(2))->method('_write');

0 comments on commit 8c57b0e

Please sign in to comment.
You can’t perform that action at this time.