diff --git a/app/config/config_example.yml b/app/config/config_example.yml index d4680c0..4c0087d 100644 --- a/app/config/config_example.yml +++ b/app/config/config_example.yml @@ -9,7 +9,7 @@ logs: Custom Pattern: type: local path: /path/to/your/monolog-viewer/installation/test/SyonixLogViewer/res/test_no_context.log - pattern: /\[(?P.*)\] (?P\w+).(?P\w+): (?P[^\[\{]+)/ + pattern: /\[(?P.*)\] (?P\w+).(?P\w+): (?P.*[^ ]+) (?P[^ ]+) (?P[^ ]+)/ Acme: Acme App: type: ftp diff --git a/src/Syonix/LogViewer/LogFile.php b/src/Syonix/LogViewer/LogFile.php index 298e4dc..a9ac0e4 100644 --- a/src/Syonix/LogViewer/LogFile.php +++ b/src/Syonix/LogViewer/LogFile.php @@ -45,7 +45,7 @@ public function load() } $file = $this->filesystem->read($this->args['path']); - $lines = explode("\n", $file); + $lines = array_reverse(explode("\n", $file)); $parser = new LineLogParser(); if(isset($this->args['pattern'])) { $hasCustomPattern = true; diff --git a/views/log.html.twig b/views/log.html.twig index 5270903..83c7c8f 100644 --- a/views/log.html.twig +++ b/views/log.html.twig @@ -38,7 +38,6 @@ {% endfor %} -
  • Newest entry
  • @@ -56,10 +55,10 @@ {{ line.date|date(app.config.dateFormat) }} - + {{ line.message }} {% if line.context|length > 0 %} -
    +
    {% for title, content in line.context %} @@ -67,6 +66,15 @@
    {{ title }}{{ content|nl2br }}
    {% endif %} + {% if line.extra|length > 0 %} +
    + + {% for title, content in line.extra %} + + {% endfor %} +
    {{ title }}{{ content|nl2br }}
    +
    + {% endif %} {% if app.config.display_logger %} {{ line.logger }}{% endif %} {% if line.context|length > 0 %} @@ -74,6 +82,11 @@ {% else %} {% endif %} + {% if line.extra|length > 0 %} + + {% else %} + + {% endif %} {% else %} diff --git a/web/css/screen.css b/web/css/screen.css index d78968e..094ba8a 100644 --- a/web/css/screen.css +++ b/web/css/screen.css @@ -444,6 +444,8 @@ header#logs .filter-dropdown a.lower { .logline.level-emergency td.logger, .logline.level-emergency div.context table th, .logline.level-emergency div.context table td, +.logline.level-emergency div.extra table th, +.logline.level-emergency div.extra table td, .logline.level-emergency td.more { color: #ff9a9a; } @@ -460,11 +462,10 @@ header#logs .filter-dropdown a.lower { display: block; font-family: "Source Code Pro", monospace; padding-top: 0; + word-break: break-all; } -.logline td.message.has-more { - cursor: pointer; -} + .logline.level-critical .message, .logline.level-alert .message { @@ -520,6 +521,28 @@ div.context table th { font-weight: bold; } +div.extra { + font-family: 'FlexoWebfont', 'Arial', sans-serif; + display: none; + margin: 5px 0 5px; +} + +div.extra table td, +div.extra table th { + vertical-align: top; + color: #8c8c8c; + padding: 5px 0 0; +} +div.extra table td { + padding-left: 20px; + word-break: break-all; +} + +div.extra table th { + vertical-align: top; + font-weight: bold; +} + div.error-message, div.placeholder-message { width: 100%; diff --git a/web/js/log.js b/web/js/log.js index 2903951..c977451 100644 --- a/web/js/log.js +++ b/web/js/log.js @@ -10,6 +10,18 @@ function toggleMore(id) { } } +function toggleMoreExtra(id) { + var extra = $('#extra-'+id); + var more = $('#moreExtra-'+id); + if(extra.is(':visible')) { + extra.slideUp(200); + more.html(''); + } else { + extra.slideDown(200); + more.html(''); + } +} + function filterContent(string) { var count = 0; var total = 0; @@ -45,6 +57,7 @@ function filterContentReset() { $(document).ready(function() { $("div.context").hide(); + $("div.extra").hide(); $("#filter-form-toggle").click(function() { var arrow = $("#filter-form-arrow"); var dropdown = $("#filter-form-dropdown");