Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://git.zendframework.com/zf
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahar Evron committed Apr 30, 2011
3 parents cc446b7 + d913f72 + 2b48cb0 commit a569f01
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 8 deletions.
32 changes: 32 additions & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Exception
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\Log\Exception;

/**
* Invalid argument exception
*
* @category Zend
* @package Zend_Log
* @subpackage Exception
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\Log\Exception
Expand Down
32 changes: 32 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Exception
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\Log\Exception;

/**
* Runtime argument exception
*
* @category Zend
* @package Zend_Log
* @subpackage Exception
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException
extends \RuntimeException
implements \Zend\Log\Exception
Expand Down
4 changes: 2 additions & 2 deletions src/Formatter/AbstractFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -32,7 +32,7 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractFormatter implements Formatter, Factory
Expand Down
3 changes: 2 additions & 1 deletion src/Writer/Firebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ protected function _write($event)
FirePhp::getInstance()->send($message,
$label,
$type,
array('traceOffset'=>6));
array('traceOffset'=>4,
'fixZendLogOffsetIfApplicable'=>true));
}
}
2 changes: 1 addition & 1 deletion src/Writer/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Stream extends AbstractWriter
* @param string|null $mode Mode, only applicable if a URL is given
* @return void
* @throws \Zend\Log\Exception\InvalidArgumentException
* @throws \Zend\Log\Excpeiton\RuntimeException
* @throws \Zend\Log\Exception\RuntimeException
*/
public function __construct($streamOrUrl, $mode = null)
{
Expand Down
4 changes: 2 additions & 2 deletions test/Formatter/FirebugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Log
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -27,7 +27,7 @@
* @category Zend
* @package Zend_Log
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Log
*/
Expand Down
51 changes: 51 additions & 0 deletions test/Writer/FirebugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,55 @@ public function testFactory()
$logger = Logger::factory($cfg['log']);
$this->assertTrue($logger instanceof Logger);
}

/**
* @group ZF-10537
*/
public function testFileLineOffsets()
{
$firephp = FirePhp::getInstance();
$channel = Channel\HttpHeaders::getInstance();
$protocol = $channel->getProtocol(FirePhp::PROTOCOL_URI);
$firephp->setOption('includeLineNumbers', true);
$firephp->setOption('maxTraceDepth', 0);

$lines = array();
// NOTE: Do NOT separate the following pairs otherwise the line numbers will not match for the test

// Message number: 1
$lines[] = __LINE__ + 1;
$this->_logger->log('Hello World', Logger::INFO);

// Message number: 2
$this->_logger->addPriority('TRACE', 8);
$this->_writer->setPriorityStyle(8, 'TRACE');
$lines[] = __LINE__ + 1;
$this->_logger->trace('Trace to here');

// Message number: 3
$this->_logger->addPriority('TABLE', 9);
$this->_writer->setPriorityStyle(9, 'TABLE');
$table = array('Summary line for the table',
array(
array('Column 1', 'Column 2'),
array('Row 1 c 1',' Row 1 c 2'),
array('Row 2 c 1',' Row 2 c 2')
)
);
$lines[] = __LINE__ + 1;
$this->_logger->table($table);

// Message number: 4
$lines[] = __LINE__ + 1;
$this->_logger->info('Hello World');

$messages = $protocol->getMessages();
$messages = $messages[FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][FirePhp::PLUGIN_URI];

for ($i = 0; $i < count($messages); $i++) {
if (!preg_match_all('/FirebugTest\.php","Line":' . $lines[$i] . '/', $messages[$i], $m)) {
$this->fail("File and line does not match for message number: " . ($i + 1));
}
}
}
}
4 changes: 2 additions & 2 deletions test/Writer/SyslogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Log
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
* @category Zend
* @package Zend_Log
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Log
*/
Expand Down

0 comments on commit a569f01

Please sign in to comment.