mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 01:40:58 -05:00
Fix docker log coloring for 6.2
This commit is contained in:
@@ -1,34 +1,3 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2015-2016, Bergware International.
|
||||
* Copyright 2015-2016, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once '/usr/local/emhttp/webGui/include/ColorCoding.php';
|
||||
|
||||
array_shift($argv);
|
||||
$colorize = ($argv[0] == 'logs');
|
||||
|
||||
if ($colorize) echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span><span class='array label'>Array</span><span class='login label'>Login</span></p>\n";
|
||||
$handle = popen('/usr/bin/docker "'.implode('" "',$argv).'"','r');
|
||||
while (!feof($handle)) {
|
||||
$line = fgets($handle);
|
||||
if ($colorize) {
|
||||
$span = "span";
|
||||
foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;}
|
||||
echo "<$span>".htmlentities($line)."</span>";
|
||||
} else {
|
||||
echo $line;
|
||||
}
|
||||
flush();
|
||||
}
|
||||
pclose($handle);
|
||||
?>
|
||||
#!/bin/bash
|
||||
# Just a wrapper.
|
||||
exec /usr/bin/docker "$@"
|
||||
Reference in New Issue
Block a user