Commit 5f28bdc5 authored by Markus Willman's avatar Markus Willman

fixes for viewing logs

parent 4b0a0f1f
......@@ -62,6 +62,7 @@ div.paging-fix {
}
.header .print-pubdate {
margin-top: 5mm;
margin-right: 5mm;
}
......@@ -78,7 +79,7 @@ div.paging-fix {
position: absolute;
}
.footer .print-pages > span:after {
.footer .print-pages > span:before {
counter-increment: page;
content: counter(page);
margin-right: 5mm;
......@@ -122,11 +123,9 @@ div.paging-fix {
height: 25mm !important;
}
/* Counters do not work for Chrome/Webkit/Edge using this setup */
@supports ((-webkit-appearance:none) and (not (-moz-appearance:none))) or (-ms-ime-align:auto) or (-ms-accelerator:true) {
.footer .print-pages {
display: none !important;
}
/* Counters do not presently work using this setup, the pages are counted but the counter displays same value or no value on all pr some pages */
.footer .print-pages {
display: none !important;
}
@page { size: auto; margin: 0 10mm 0 15mm !important; }
......@@ -51,6 +51,9 @@ class LogHandler extends AbstractHandler
protected static function serveLogFile(WebRequest $request, SplFileInfo $file, $template_name, ParserInterface $parser)
{
if ($request->variable('download', false) !== false)
return WebResponse::file($request, $file, true);
if ($request->variable('source', '') === 'raw')
return WebResponse::text($request, $file, 'text/plain');
......
......@@ -14,7 +14,7 @@
{% set template_file = log_file %} {# We replace the template_file global because this file is a wrapper #}
{% set container_class = 'container full' %}
{% set page_subtitle = log_file | replace({ '.log' : '' }) %}
{% set page_subtitle = 'Log file: ' ~ log_file %}
{% set hide_menu = true %}
{% set source_view = false %}
......@@ -23,20 +23,28 @@
<!-- log styles -->
<style>
.dclog { white-space: pre-wrap !important; }
.dclog > .nick { font-weight: bold; }
.dclog > .timestamp { color: #CCC; }
.dclog { white-space:pre-wrap !important; border:none !important; page-break-inside:auto !important; page-break-before:avoid !important }
.dclog > .nick { font-weight:bold }
.bs-dark .dclog > .nick { font-weight:bolder; color:#CCC }
.dclog > .timestamp { color:#CCC }
</style>
{% endblock %}
{% block content -%}
<h4 class="float-left">Log file: {{ log_file }}</h4>
<div class="text-right">
<a class="btn btn-primary" href="{{ make_url(page_url, 'source=raw') }}">Raw Log</a>
<h4 class="float-left d-print-none">Log file: {{ log_file }}</h4>
<div class="text-right d-print-none">
<a class="btn btn-primary" role="button" href="{{ util.sanitize_url('/' ~ source_file, 'source=raw') }}">
<i class="fas fa-file-alt" aria-hidden="true"></i> Raw Log
</a>
<a class="btn btn-primary" role="button" href="{{ util.sanitize_url('/' ~ source_file, 'download=1') }}">
<i class="fas fa-download" aria-hidden="true"></i> Download
</a>
<hr>
</div>
<div>
<pre class="dclog">{% dclog log_file %}</pre>
<pre class="dclog">
{%- dclog log_file %} {#- cache doesn't invalidate when classes the parser depends on change, e.g. auto linking -#}
</pre>
</div>
{% endblock %}
......@@ -343,10 +343,13 @@ class TextFormatExtension extends TwigAbstractExtension
$debug_info = '';
$cache_file = $this->options['cache'] . '/' . $cache_info['cache_key'] . '.ccache';
if (Util::isDebug())
$cache_tag = '';
if (Util::isDebug() || $this->env->isDebug())
{
$debug_info = "($source_file, {$cache_info['block_id']})";
$cache_tag = '<!-- Generated on '. date('Y-m-d - g:ia') ." with parser \"{$cache_info['parser']}\" $debug_info". PHP_EOL .' -->';
}
$cache_tag = '<!-- Generated on '. date('Y-m-d - g:ia') ." with parser \"{$cache_info['parser']}\" $debug_info -->". PHP_EOL;
return Util::stringToFile($cache_file, $cache_tag . $parsed_content);
}
......
Markdown is supported
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