deployment: show colorized log

This commit is contained in:
Thomas Gelf 2016-03-15 21:54:49 +01:00
parent 41b909e64e
commit 5e80516f6d
2 changed files with 48 additions and 2 deletions

View File

@ -2,6 +2,17 @@
use Icinga\Util\Format;
function colorize($log) {
$log = preg_replace(
'/^(debug|notice|information|warning|critical)\/(\w+)/m',
'<span class="loglevel \1">\1</span>/<span class="application">\2</span>',
$log
);
$log = preg_replace('/([\^]{2,})/', '<span class="error-hint">\1</span>', $log);
return $log;
}
?><div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
@ -73,7 +84,9 @@ if ($deployment->startup_succeeded === null) {
<?php if ($deployment->startup_succeeded !== null): ?>
<h2>Startup log</h2>
<pre class="logfile">
<?= $this->escape($deployment->startup_log) ?>
<?= colorize(
$this->escape($deployment->startup_log)
) ?>
</pre>
<?php endif ?>
</div>

View File

@ -37,7 +37,40 @@ pre {
pre.logfile {
font-size: 0.875em;
padding: 0;
padding: 1em;
background-color: #222;
color: #ddd;
overflow: auto;
white-space: pre;
.loglevel, .application {
font-weight: bold;
}
.critical {
color: @color-critical;
}
.warning {
color: @color-warning;
}
.information {
color: @color-ok;
}
.notice {
// color: @color-ok;
}
.debug {
color: @color-pending;
}
.error-hint {
color: #fff;
font-weight: 900;
}
}
table.avp th {