From 5e80516f6df3a821680b8201ba7e69b13bd18749 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 15 Mar 2016 21:54:49 +0100 Subject: [PATCH] deployment: show colorized log --- .../views/scripts/deployment/index.phtml | 15 +++++++- public/css/module.less | 35 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/application/views/scripts/deployment/index.phtml b/application/views/scripts/deployment/index.phtml index da24aed1..743f72b5 100644 --- a/application/views/scripts/deployment/index.phtml +++ b/application/views/scripts/deployment/index.phtml @@ -2,6 +2,17 @@ use Icinga\Util\Format; +function colorize($log) { + $log = preg_replace( + '/^(debug|notice|information|warning|critical)\/(\w+)/m', + '\1/\2', + $log + ); + + $log = preg_replace('/([\^]{2,})/', '\1', $log); + return $log; +} + ?>
tabs ?>

escape($this->title) ?>

@@ -73,7 +84,9 @@ if ($deployment->startup_succeeded === null) { startup_succeeded !== null): ?>

Startup log

-escape($deployment->startup_log) ?>
+escape($deployment->startup_log)
+) ?>
 
diff --git a/public/css/module.less b/public/css/module.less index e5a57346..0ba1911e 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -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 {