Skip to content
Extraits de code Groupes Projets
Valider 5c266951 rédigé par Matthieu Napoli's avatar Matthieu Napoli
Parcourir les fichiers

#6622 Logger refactoring: Separated error and exception handling from logging

- the error handler logs warnings and notices, and turns errors into exceptions (`ErrorException`)
- the exception handler catches all uncatched exceptions and display them to the user (HTML or CLI)
- the "screen" logging backend has been removed
- I've normalized exceptions/errors shown to the user in HTML (wether they are catched by the FrontController or not)
parent af921f72
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 171 ajouts et 341 suppressions
......@@ -4,7 +4,6 @@ use Interop\Container\ContainerInterface;
use Monolog\Logger;
use Piwik\Common;
use Piwik\Log;
use Piwik\Log\Handler\StdErrHandler;
return array(
......@@ -27,54 +26,38 @@ return array(
// Log
'Psr\Log\LoggerInterface' => DI\object('Monolog\Logger')
->constructor('piwik', DI\link('log.handlers'), DI\link('log.processors')),
'Piwik\Log' => DI\object()
->constructor(DI\link('Psr\Log\LoggerInterface')),
'log.handlers' => DI\factory(function (ContainerInterface $c) {
if ($c->has('old_config.log.log_writers')) {
$writerNames = $c->get('old_config.log.log_writers');
}
if (empty($writerNames)) {
} else {
return array();
}
$classes = array(
'file' => 'Piwik\Log\Handler\FileHandler',
'screen' => 'log.handlers.stdout',
'database' => 'Piwik\Log\Handler\DatabaseHandler',
);
$writerNames = array_map('trim', $writerNames);
$writers = array();
foreach ($writerNames as $writerName) {
if (isset($classes[$writerName])) {
$class = $classes[$writerName];
$writers[$writerName] = $c->get($class);
$writers[$writerName] = $c->get($classes[$writerName]);
}
}
// Always add the stderr handler
$isLoggingToStdOut = isset($writers['screen']);
$writers['stderr'] = new StdErrHandler($c->get('Piwik\Log\Formatter\ExceptionHtmlFormatter'), $isLoggingToStdOut);
return array_values($writers);
}),
'log.processors' => array(
DI\link('Piwik\Log\Processor\ClassNameProcessor'),
DI\link('Piwik\Log\Processor\RequestIdProcessor'),
DI\link('Piwik\Log\Processor\ExceptionToTextProcessor'),
DI\link('Piwik\Log\Processor\SprintfProcessor'),
DI\link('Monolog\Processor\PsrLogMessageProcessor'),
),
'Piwik\Log\Handler\FileHandler' => DI\object()
->constructor(DI\link('log.file.filename'), DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\LineMessageFormatter'))
->method('pushProcessor', DI\link('Piwik\Log\Processor\ExceptionToTextProcessor')),
->method('setFormatter', DI\link('Piwik\Log\Formatter\LineMessageFormatter')),
'Piwik\Log\Handler\DatabaseHandler' => DI\object()
->constructor(DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\LineMessageFormatter'))
->method('pushProcessor', DI\link('Piwik\Log\Processor\ExceptionToTextProcessor')),
'log.handlers.stdout' => DI\object('Monolog\Handler\StreamHandler')
->constructor('php://output', DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\ExceptionHtmlFormatter')),
->method('setFormatter', DI\link('Piwik\Log\Formatter\LineMessageFormatter')),
'log.level' => DI\factory(function (ContainerInterface $c) {
if ($c->get('log.disabled')) {
return Log::getMonologLevel(Log::NONE);
......@@ -123,8 +106,6 @@ return array(
return $logPath;
}),
'Piwik\Log\Formatter\ExceptionHtmlFormatter' => DI\object()
->constructor(DI\link('Piwik\Log\Formatter\LineMessageFormatter')),
'Piwik\Log\Formatter\LineMessageFormatter' => DI\object()
->constructor(DI\link('log.format')),
'log.format' => DI\factory(function (ContainerInterface $c) {
......
......@@ -25,5 +25,12 @@ if (!Piwik\Common::isPhpCliMode()) {
exit;
}
if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
require_once PIWIK_INCLUDE_PATH . '/core/Error.php';
\Piwik\Error::setErrorHandler();
require_once PIWIK_INCLUDE_PATH . '/core/ExceptionHandler.php';
\Piwik\ExceptionHandler::setUp();
}
$console = new Piwik\Console();
$console->run();
\ No newline at end of file
......@@ -4,11 +4,11 @@
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik;
require_once PIWIK_INCLUDE_PATH . '/core/Log.php';
use Piwik\Exception\ErrorException;
/**
* Piwik's error handler function.
......@@ -71,9 +71,6 @@ class Error
return;
}
$error = new \ErrorException($errstr, 0, $errno, $errfile, $errline);
Log::error($error);
switch ($errno) {
case E_ERROR:
case E_PARSE:
......@@ -82,7 +79,10 @@ class Error
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
case E_USER_ERROR:
exit;
// Convert the error to an exception with an HTML message
$e = new \Exception();
$message = self::getHtmlMessage($errno, $errstr, $errfile, $errline, $e->getTraceAsString());
throw new ErrorException($message, 0, $errno, $errfile, $errline);
break;
case E_WARNING:
......@@ -94,8 +94,37 @@ class Error
case E_DEPRECATED:
case E_USER_DEPRECATED:
default:
// do not exit
Log::info(self::createLogMessage($errno, $errstr, $errfile, $errline));
break;
}
}
private static function createLogMessage($errno, $errstr, $errfile, $errline)
{
return sprintf(
"%s(%d): %s - %s",
$errfile,
$errline,
Error::getErrNoString($errno),
$errstr
);
}
private static function getHtmlMessage($errno, $errstr, $errfile, $errline, $trace)
{
$trace = Log::$debugBacktraceForTests ?: $trace;
$message = Error::getErrNoString($errno) . ' - ' . $errstr;
$html = "<strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? Version::VERSION : '') . ")
and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).</strong><br /><br/>
";
$html .= "<strong>{$message}</strong> in <em>{$errfile}</em>";
$html .= " on line {$errline}<br />";
$html .= "<br />Backtrace:<div style=\"font-family:Courier;font-size:10pt\"><br />\n";
$html .= str_replace("\n", "<br />\n", $trace);
$html .= "</div>";
return $html;
}
}
<?php
namespace Piwik\Exception;
/**
* ErrorException
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class ErrorException extends \ErrorException
{
public function isHtmlMessage()
{
return true;
}
}
......@@ -8,6 +8,9 @@
*/
namespace Piwik;
use Exception;
use Piwik\Plugins\CoreAdminHome\CustomLogo;
/**
* Contains Piwik's uncaught exception handler.
*/
......@@ -15,11 +18,82 @@ class ExceptionHandler
{
public static function setUp()
{
set_exception_handler(array('Piwik\ExceptionHandler', 'logException'));
set_exception_handler(array('Piwik\ExceptionHandler', 'handleException'));
}
public static function handleException(Exception $exception)
{
if (Common::isPhpCliMode()) {
self::dieWithCliError($exception);
}
self::dieWithHtmlErrorPage($exception);
}
public static function dieWithCliError(Exception $exception)
{
$message = $exception->getMessage();
if (!method_exists($exception, 'isHtmlMessage') || !$exception->isHtmlMessage()) {
$message = strip_tags(str_replace('<br />', PHP_EOL, $message));
}
$message = sprintf(
"Uncaught exception: %s\nin %s line %d\n%s\n",
$message,
$exception->getFile(),
$exception->getLine(),
$exception->getTraceAsString()
);
echo $message;
exit(1);
}
public static function dieWithHtmlErrorPage(Exception $exception)
{
Common::sendHeader('Content-Type: text/html; char1set=utf-8');
echo self::getErrorResponse($exception);
exit(1);
}
public static function logException(\Exception $exception)
private static function getErrorResponse(Exception $ex)
{
Log::error($exception);
$debugTrace = $ex->getTraceAsString();
$message = $ex->getMessage();
if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) {
$message = Common::sanitizeInputValue($message);
}
$logo = new CustomLogo();
$logoHeaderUrl = false;
$logoFaviconUrl = false;
try {
$logoHeaderUrl = $logo->getHeaderLogoUrl();
$logoFaviconUrl = $logo->getPathUserFavicon();
} catch (Exception $ex) {
Log::debug($ex);
}
$result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl);
/**
* Triggered before a Piwik error page is displayed to the user.
*
* This event can be used to modify the content of the error page that is displayed when
* an exception is caught.
*
* @param string &$result The HTML of the error page.
* @param Exception $ex The Exception displayed in the error page.
*/
Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex));
return $result;
}
}
......@@ -18,7 +18,6 @@ use Piwik\Http\Router;
use Piwik\Plugin\Controller;
use Piwik\Plugin\Report;
use Piwik\Plugin\Widgets;
use Piwik\Plugins\CoreAdminHome\CustomLogo;
use Piwik\Session;
/**
......@@ -610,48 +609,4 @@ class FrontController extends Singleton
Piwik::postEvent('Request.dispatch.end', array(&$result, $module, $action, $parameters));
return $result;
}
/**
* Returns HTML that displays an exception's error message (and possibly stack trace).
* The result of this method is echo'd by dispatch.php.
*
* @param Exception $ex The exception to use when generating the error page's HTML.
* @return string The HTML to echo.
*/
public function getErrorResponse(Exception $ex)
{
$debugTrace = $ex->getTraceAsString();
$message = $ex->getMessage();
if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) {
$message = Common::sanitizeInputValue($message);
}
$logo = new CustomLogo();
$logoHeaderUrl = false;
$logoFaviconUrl = false;
try {
$logoHeaderUrl = $logo->getHeaderLogoUrl();
$logoFaviconUrl = $logo->getPathUserFavicon();
} catch (Exception $ex) {
Log::debug($ex);
}
$result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl);
/**
* Triggered before a Piwik error page is displayed to the user.
*
* This event can be used to modify the content of the error page that is displayed when
* an exception is caught.
*
* @param string &$result The HTML of the error page.
* @param Exception $ex The Exception displayed in the error page.
*/
Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex));
return $result;
}
}
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Log\Formatter;
use Piwik\Common;
use Piwik\Error;
use Piwik\Log;
use Piwik\Version;
/**
* Formats a log message containing an exception object into an HTML response.
*/
class ExceptionHtmlFormatter extends Formatter
{
public function format(array $record)
{
if (! $this->contextContainsException($record)) {
return $this->next($record);
}
/** @var \Exception $exception */
$exception = $record['context']['exception'];
Common::sendHeader('Content-Type: text/html; charset=utf-8');
$trace = Log::$debugBacktraceForTests ?: $exception->getTraceAsString();
$message = $this->getMessage($exception);
$html = '';
$html .= "<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
<strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? Version::VERSION : '') . ")
and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).</strong><br /><br/>
";
$html .= "<em>{$message}</em> in <strong>{$exception->getFile()}</strong>";
$html .= " on line <strong>{$exception->getLine()}</strong>\n";
$html .= "<br /><br />Backtrace --&gt;<div style=\"font-family:Courier;font-size:10pt\"><br />\n";
$html .= str_replace("\n", "<br />\n", $trace);
$html .= "</div>";
$html .= "</div>\n";
return $html;
}
private function contextContainsException($record)
{
return isset($record['context']['exception'])
&& $record['context']['exception'] instanceof \Exception;
}
private function getMessage(\Exception $exception)
{
if ($exception instanceof \ErrorException) {
return Error::getErrNoString($exception->getSeverity()) . ' - ' . $exception->getMessage();
}
return $exception->getMessage();
}
}
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Log\Formatter;
use Monolog\Formatter\FormatterInterface;
/**
* Formats a log message.
*
* Follows the Chain of responsibility design pattern.
*/
abstract class Formatter implements FormatterInterface
{
/**
* @var Formatter|null
*/
protected $next;
public function __construct(Formatter $next = null)
{
$this->next = $next;
}
/**
* {@inheritdoc}
*/
public function formatBatch(array $records)
{
foreach ($records as $key => $record) {
$records[$key] = $this->format($record);
}
return $records;
}
/**
* Chain of responsibility pattern.
*
* @param Formatter $formatter
*/
public function setNext(Formatter $formatter)
{
$this->next = $formatter;
}
protected function next(array $record)
{
if (! $this->next) {
throw new \RuntimeException('No next formatter to call');
}
return $this->next->format($record);
}
}
......@@ -8,10 +8,12 @@
namespace Piwik\Log\Formatter;
use Monolog\Formatter\FormatterInterface;
/**
* Formats a log message into a line of text.
* Formats a log message into a line of text using our custom Piwik log format.
*/
class LineMessageFormatter extends Formatter
class LineMessageFormatter implements FormatterInterface
{
/**
* The log message format string that turns a tag name, date-time and message into
......@@ -49,6 +51,15 @@ class LineMessageFormatter extends Formatter
return $message;
}
public function formatBatch(array $records)
{
foreach ($records as $key => $record) {
$records[$key] = $this->format($record);
}
return $records;
}
private function prefixMessageWithRequestId(array $record)
{
$requestId = isset($record['extra']['request_id']) ? $record['extra']['request_id'] : '';
......
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Log\Handler;
use Monolog\Formatter\FormatterInterface;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
/**
* Writes log to stderr.
*/
class StdErrHandler extends AbstractProcessingHandler
{
/**
* @var bool
*/
private $isLoggingToStdOut;
public function __construct(FormatterInterface $formatter, $isLoggingToStdOut)
{
$this->isLoggingToStdOut = $isLoggingToStdOut;
// Log level is hardcoded for this one
$level = Logger::ERROR;
parent::__construct($level);
$this->setFormatter($formatter);
}
protected function write(array $record)
{
// Do not log on stderr during tests (prevent display of errors in CI output)
if (! defined('PIWIK_TEST_MODE')) {
$this->writeToStdErr($record['formatted']);
}
// This is the result of an old hack, I guess to force the error message to be displayed in case of errors
// TODO we should get rid of it somehow
if (! $this->isLoggingToStdOut) {
echo $record['formatted'];
}
}
private function writeToStdErr($message)
{
$fe = fopen('php://stderr', 'w');
fwrite($fe, $message);
}
}
......@@ -39,10 +39,6 @@ if (PIWIK_ENABLE_DISPATCH) {
echo $response;
}
} catch (Exception $ex) {
$response = $controller->getErrorResponse($ex);
echo $response;
exit(1);
ExceptionHandler::dieWithHtmlErrorPage($ex);
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ require_once PIWIK_INCLUDE_PATH . '/tests/resources/TestPluginLogClass.php';
/**
* @group Core
* @group Core_LogTest
* @group Log
*/
class LogTest extends IntegrationTestCase
{
......@@ -33,49 +33,19 @@ class LogTest extends IntegrationTestCase
const STRING_MESSAGE_FORMAT_SPRINTF = "[%s] %s";
public static $expectedExceptionOutput = array(
'screen' => '<div style=\'word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;\'>
<strong>There is an error. Please report the message
and full backtrace in the <a href=\'?module=Proxy&action=redirect&url=http://forum.piwik.org\' target=\'_blank\'>Piwik forums</a> (please do a Search first as it might have been reported already!).</strong><br /><br/>
<em>dummy error message</em> in <strong>LogTest.php</strong> on line <strong>174</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
dummy backtrace</div></div>',
'file' => '[Piwik\Tests\Integration\LogTest] LogTest.php(174): dummy error message
'file' => '[Piwik\Tests\Integration\LogTest] LogTest.php(132): dummy error message
dummy backtrace',
'database' => '[Piwik\Tests\Integration\LogTest] LogTest.php(174): dummy error message
'database' => '[Piwik\Tests\Integration\LogTest] LogTest.php(132): dummy error message
dummy backtrace'
);
public static $expectedErrorOutput = array(
'screen' => '<div style=\'word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;\'>
<strong>There is an error. Please report the message
and full backtrace in the <a href=\'?module=Proxy&action=redirect&url=http://forum.piwik.org\' target=\'_blank\'>Piwik forums</a> (please do a Search first as it might have been reported already!).</strong><br /><br/>
<em>Unknown error (102) - dummy error string</em> in <strong>dummyerrorfile.php</strong> on line <strong>145</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
dummy backtrace</div></div>',
'file' => '[Piwik\Tests\Integration\LogTest] dummyerrorfile.php(145): Unknown error (102) - dummy error string
dummy backtrace',
'database' => '[Piwik\Tests\Integration\LogTest] dummyerrorfile.php(145): Unknown error (102) - dummy error string
dummy backtrace'
);
private $screenOutput;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Error::setErrorHandler();
ExceptionHandler::setUp();
}
public static function tearDownAfterClass()
{
restore_error_handler();
restore_exception_handler();
parent::tearDownAfterClass();
}
public function setUp()
{
parent::setUp();
......@@ -110,7 +80,6 @@ dummy backtrace</div></div>',
public function getBackendsToTest()
{
return array(
'screen' => array('screen'),
'file' => array('file'),
'database' => array('database'),
);
......@@ -123,10 +92,7 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
Log::warning(self::TESTMESSAGE);
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = __CLASS__);
}
......@@ -138,10 +104,7 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
Log::warning(self::TESTMESSAGE, " subst ");
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, sprintf(self::TESTMESSAGE, " subst "), $formatMessage = true, $tag = __CLASS__);
}
......@@ -153,14 +116,10 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
$error = new \ErrorException("dummy error string", 0, 102, "dummyerrorfile.php", 145);
Log::error($error);
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, self::$expectedErrorOutput[$backend], $formatMessage = false, $tag = __CLASS__);
$this->checkBackend('screen', self::$expectedErrorOutput['screen']); // errors should always written to the screen
}
/**
......@@ -170,14 +129,10 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
$exception = new Exception("dummy error message");
Log::error($exception);
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, self::$expectedExceptionOutput[$backend], $formatMessage = false, $tag = __CLASS__);
$this->checkBackend('screen', self::$expectedExceptionOutput['screen']); // errors should always written to the screen
}
/**
......@@ -187,10 +142,7 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
TestLoggingUtility::doLog(self::TESTMESSAGE);
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = 'TestPlugin');
}
......@@ -203,10 +155,7 @@ dummy backtrace</div></div>',
Config::getInstance()->log['log_writers'] = array($backend);
Config::getInstance()->log['log_level'] = 'ERROR';
ob_start();
Log::info(self::TESTMESSAGE);
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkNoMessagesLogged($backend);
}
......@@ -218,10 +167,7 @@ dummy backtrace</div></div>',
{
Config::getInstance()->log['log_writers'] = array($backend);
ob_start();
TestLoggingUtility::doLog(" \n ".self::TESTMESSAGE."\n\n\n \n");
$this->screenOutput = ob_get_contents();
ob_end_clean();
$this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = 'TestPlugin');
}
......@@ -232,19 +178,7 @@ dummy backtrace</div></div>',
$expectedMessage = sprintf(self::STRING_MESSAGE_FORMAT_SPRINTF, $tag, $expectedMessage);
}
// remove version number from message
$this->screenOutput = str_replace(" (Piwik ". \Piwik\Version::VERSION.")", "", $this->screenOutput);
if ($backend == 'screen') {
if ($formatMessage
&& !Common::isPhpCliMode()) {
$expectedMessage = '<pre>' . $expectedMessage . '</pre>';
}
$this->screenOutput = $this->removePathsFromBacktrace($this->screenOutput);
$this->assertEquals($expectedMessage . "\n", $this->screenOutput, "unexpected output: ".$this->screenOutput);
} else if ($backend == 'file') {
if ($backend == 'file') {
$this->assertTrue(file_exists(self::getLogFileLocation()));
$fileContents = file_get_contents(self::getLogFileLocation());
......@@ -270,9 +204,7 @@ dummy backtrace</div></div>',
private function checkNoMessagesLogged($backend)
{
if ($backend == 'screen') {
$this->assertEmpty($this->screenOutput, "Output not empty: ".$this->screenOutput);
} else if ($backend == 'file') {
if ($backend == 'file') {
$this->assertFalse(file_exists(self::getLogFileLocation()));
} else if ($backend == 'database') {
$this->assertEquals(0, Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('logger_message')));
......
......@@ -11,6 +11,11 @@ namespace Piwik\Tests\Unit\Log\Formatter;
use DateTime;
use Piwik\Log\Formatter\LineMessageFormatter;
/**
* @group Core
* @group Log
* @covers \Piwik\Log\Formatter\LineMessageFormatter
*/
class LineMessageFormatterTest extends \PHPUnit_Framework_TestCase
{
/**
......
......@@ -12,6 +12,7 @@ use Piwik\Log\Processor\ClassNameProcessor;
/**
* @group Core
* @group Log
* @covers \Piwik\Log\Processor\ClassNameProcessor
*/
class ClassNameProcessorTest extends \PHPUnit_Framework_TestCase
......
......@@ -12,6 +12,8 @@ use Piwik\Log;
use Piwik\Log\Processor\ExceptionToTextProcessor;
/**
* @group Core
* @group Log
* @covers \Piwik\Log\Processor\ExceptionToTextProcessor
*/
class ExceptionToTextProcessorTest extends \PHPUnit_Framework_TestCase
......@@ -46,7 +48,7 @@ class ExceptionToTextProcessorTest extends \PHPUnit_Framework_TestCase
$result = $processor($record);
$expected = array(
'message' => __FILE__ . "(39): Hello world\n[stack trace]",
'message' => __FILE__ . "(41): Hello world\n[stack trace]",
'context' => array(
'exception' => $exception,
),
......
......@@ -13,6 +13,7 @@ use Piwik\Log\Processor\RequestIdProcessor;
/**
* @group Core
* @group Log
* @covers \Piwik\Log\Processor\RequestIdProcessor
*/
class RequestIdProcessorTest extends \PHPUnit_Framework_TestCase
......
......@@ -12,6 +12,7 @@ use Piwik\Log\Processor\SprintfProcessor;
/**
* @group Core
* @group Log
* @covers \Piwik\Log\Processor\SprintfProcessor
*/
class SprintfProcessorTest extends \PHPUnit_Framework_TestCase
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter