Critical errors are shown by Tracy and are now on top.
This commit is contained in:
Abel Hoogeveen 2016-08-07 13:03:07 +02:00
parent dbdeddd1f8
commit 158092d811
3 changed files with 28 additions and 6 deletions

View File

@ -79,8 +79,28 @@ class LoggerTracyBridge implements IBarPanel {
public function getPanel()
{
// If an error is thrown, log it
$errfile = 'Unknown file';
$errstr = 'shutdown';
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if ($error !== null) {
$errno = $error['type'];
$errfile = $error['file'];
$errline = $error['line'];
$errstr = $error['message'];
// Log it!
Logger::errorHandler($errno, $errstr, $errfile, $errline);
}
// Reverse the logs
$logs = array_reverse(Logger::$Logs, true);
// Parse the panel
ob_start(function () {});
$logs = Logger::$Logs;
require dirname(__DIR__) . '/views/view.tracyloggerpanel.php';
return ob_get_clean();
}

View File

@ -38,6 +38,7 @@
<table>
<thead>
<tr>
<th>#</th>
<th>Type</th>
<th>Message</th>
<th>File</th>
@ -47,7 +48,7 @@
</thead>
<tbody>
<?php foreach ($logs as $log): ?>
<?php foreach ($logs as $key => $log): ?>
<?php if ($log['type'] === 'LEVEL_STOP')
{
continue;
@ -58,6 +59,7 @@
}
?>
<tr class="<?php echo($log['type']); ?>">
<td><?php echo( htmlspecialchars($key)); ?></td>
<td><?php echo( htmlspecialchars ($log['type'])); ?></td>
<td><?php echo( htmlspecialchars ($log['message'])); ?></td>
<td><?php echo( empty($log['logFile']) ? 'x' : htmlspecialchars ($log['logFile'])); ?></td>

View File

@ -223,20 +223,20 @@ class loggerTest extends CoreTestAbstract
Logger::http_error(404, false);
}
public function testEnable()
public function testEnableDisable()
{
// First enable
Logger::enable();
$this->assertTrue(Logger::isEnabled());
}
public function testDisable()
{
// Then disable
Logger::disable();
$this->assertFalse(Logger::isEnabled());
}
public function tearDown()
{
Logger::disable();
Logger::$Logs = array();
}
}