Commit 327ea350 authored by Tomáš Pospíšil's avatar Tomáš Pospíšil
Browse files

Error counts

parent c41fb75e
......@@ -7,6 +7,7 @@ namespace Praguebest\Tools;
use Arrayy\Arrayy;
use Nette\Utils\Strings;
use Tracy\Helpers;
use Tracy\ILogger;
final class ErrorFilesParser
{
......@@ -30,7 +31,11 @@ final class ErrorFilesParser
$this->processFile($file);
}
$this->errors = $this->errors->sorter('time');
$this->errors = $this->errors->sorter(
static function ($a) {
return $a['time'];
}
);
return $this->errors;
}
......@@ -52,6 +57,7 @@ final class ErrorFilesParser
[
'time' => filectime($filename) ?? 0,
'type' => $type,
'filename' => basename($filename),
'message' => Strings::truncate($message['message'] ?? '', 200),
'link' => Helpers::editorLink($message['location'] ?? '', (int)$message['row']),
]
......@@ -66,7 +72,8 @@ final class ErrorFilesParser
{
$type = (string)Strings::match(basename($filename), '#(.*?)-.*#')[1];
if (!isset($this->errors[$type])) {
$types = [ILogger::CRITICAL, ILogger::EXCEPTION, ILogger::ERROR, ILogger::INFO, ILogger::DEBUG, ILogger::WARNING, self::UNKNOWN];
if (!in_array($type, $types, true)) {
$type = self::UNKNOWN;
}
......
<h1>{$criticals} errors, {$warnings} warnings, {$infos} infos</h1>
<div class="tracy-inner">
<h1 style="margin: 0;">{$errorCount} errors</h1>
<div class="tracy-inner-container">
<form method="post">
<table>
{foreach $errors as $error}
<tr>
<td>
<div><strong>{$error.message}</strong></div>
<div>
<small>
<strong style="width: 50px; color: white;">
{if in_array($error.type, ['critical','exception','error','unknown'])}
<span style="width: 50px; color: white; background-color: red;">{$type}</span>
<strong style="background-color: red; padding: 0 5px;">{$error.type}</strong>
{elseif $error.type==='warning'}
<span style="width: 50px; color: white; background-color: yellow;">{$type}</span>
<strong style="background-color: yellow; padding: 0 5px;">{$error.type}</strong>
{else}
<span style="width: 50px; color: white; background-color: lightskyblue;"> {$type}</span>
<strong style="background-color: lightskyblue; padding: 0 5px;"> {$error.type}</strong>
{/if}
- {$error.link nofilter} - {$error.time|date_format:'Y-m-d&\nb\sp;H:i:s'}
</strong><strong>{$error.message}</strong>
</div>
<div>
<small>
{$error.filename nofilter} - {$error.link nofilter} - {$error.time|date_format:'Y-m-d&\nb\sp;H:i:s'}
</small>
</div>
</td>
......
{if $errorCount > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: red"><strong>{$criticals.count}</strong> critical errors</span>
{elseif $warnings.count > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: yellow"><strong>{$warnings.count}</strong> warnings</span>
{elseif $infos.count > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: lightskyblue"><strong>{$infos.count}</strong> infos</span>
{if $criticals > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: red"><strong>{$criticals}</strong> critical errors</span>
{elseif $warnings > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: yellow"><strong>{$warnings}</strong> warnings</span>
{elseif $infos > 0}
<span style="display: inline-block;color: white;padding: 0 5px;background-color: lightskyblue"><strong>{$infos}</strong> infos</span>
{/if}
......@@ -19,8 +19,8 @@
background-color: lightgray;
}
</style>
<h1>Settings</h1>
<div class="tracy-inner">
<h1 style="margin: 0;">Settings</h1>
<div class="tracy-inner-container">
<form method="post">
<table>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment