Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update syslog to use namespaces.
  • Loading branch information
markstory committed May 24, 2013
1 parent 5290597 commit 8c57b0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
7 changes: 3 additions & 4 deletions lib/Cake/Log/Engine/SyslogLog.php
Expand Up @@ -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
Expand Down
Expand Up @@ -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,
Expand All @@ -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');
}
Expand All @@ -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');
Expand Down

0 comments on commit 8c57b0e

Please sign in to comment.