summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-19 00:11:50 +0200
committerGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-19 00:11:50 +0200
commitd15b81d099ae8c1d41be3f71d941e860cfa1336d (patch)
tree2750cfc92d1642566b7e6433c3bcef015f48b215
parentfix typo (diff)
downloadpyload-d15b81d099ae8c1d41be3f71d941e860cfa1336d.tar.xz
added: colred logs for webui to (currently only for theme "Next")
-rw-r--r--pyload/webui/app/pyloadweb.py6
-rw-r--r--pyload/webui/themes/Next/css/log.css40
-rw-r--r--pyload/webui/themes/Next/tml/logs.html2
3 files changed, 45 insertions, 3 deletions
diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py
index 0d4bbfe51..b3baed3eb 100644
--- a/pyload/webui/app/pyloadweb.py
+++ b/pyload/webui/app/pyloadweb.py
@@ -399,6 +399,7 @@ def logs(item=-1):
warning = ""
conf = PYLOAD.getConfigValue("log", "file_log")
+ color_template = PYLOAD.getConfigValue("log", "color_template") if PYLOAD.getConfigValue("log", "color_console") else ""
if not conf:
warning = "Warning: File log is disabled, see settings page."
@@ -445,7 +446,7 @@ def logs(item=-1):
if counter >= item:
try:
date, time, level, message = l.decode("utf8", "ignore").split(" ", 3)
- dtime = datetime.strptime(date + ' ' + time, '%d.%m.%Y %H:%M:%S')
+ dtime = datetime.strptime(date + ' ' + time, '%Y-%m-%d %H:%M:%S')
except Exception:
dtime = None
date = '?'
@@ -469,7 +470,8 @@ def logs(item=-1):
return render_to_response('logs.html', {'warning': warning, 'log': data, 'from': fro.strftime('%d.%m.%Y %H:%M:%S'),
'reversed': reversed, 'perpage': perpage, 'perpage_p': sorted(perpage_p),
'iprev': 1 if item - perpage < 1 else item - perpage,
- 'inext': (item + perpage) if item + perpage < len(log) else item},
+ 'inext': (item + perpage) if item + perpage < len(log) else item,
+ 'color_template': color_template},
[pre_processor])
diff --git a/pyload/webui/themes/Next/css/log.css b/pyload/webui/themes/Next/css/log.css
index af2ea4fe8..71ba01edb 100644
--- a/pyload/webui/themes/Next/css/log.css
+++ b/pyload/webui/themes/Next/css/log.css
@@ -51,6 +51,46 @@ td.loglevel
{
text-align:right;
}
+td.mixedDEBUG, td.lineDEBUG, td.loglevellineDEBUG
+{
+ color: darkcyan;
+}
+td.mixedWARNING, td.lineWARNING, td.loglevellineWARNING
+{
+ color: #660;
+}
+td.mixedERROR, td.lineERROR, td.loglevellineERROR
+{
+ color: red;
+}
+td.mixedCRITICAL, td.lineCRITICAL, td.loglevellineCRITICAL
+{
+ color: purple;
+}
+td.loglevelmixedDEBUG span, td.loglevellabelDEBUG span
+{
+ font-weight: bold;
+ color: white;
+ background-color: darkcyan;
+}
+td.loglevelmixedWARNING span, td.loglevellabelWARNING span
+{
+ font-weight: bold;
+ color: white;
+ background-color: #660;
+}
+td.loglevelmixedERROR span, td.loglevellabelERROR span
+{
+ font-weight: bold;
+ color: white;
+ background-color: red;
+}
+td.loglevelmixedCRITICAL span, td.loglevellabelCRITICAL span
+{
+ font-weight: bold;
+ color: white;
+ background-color: purple;
+}
.logperpage
{
float: right;
diff --git a/pyload/webui/themes/Next/tml/logs.html b/pyload/webui/themes/Next/tml/logs.html
index 8e995c465..f0f25a9dd 100644
--- a/pyload/webui/themes/Next/tml/logs.html
+++ b/pyload/webui/themes/Next/tml/logs.html
@@ -27,7 +27,7 @@
<div class="logdiv">
<table class="logtable" cellpadding="0" cellspacing="0">
{% for line in log %}
- <tr><td class="logline">{{line.line}}</td><td>{{line.date}}</td><td class="loglevel">{{line.level}}</td><td>{{line.message}}</td></tr>
+ <tr><td class="logline">{{line.line}}</td><td class="{{color_template}}{{line.level}}">{{line.date}}</td><td class="loglevel loglevel{{color_template}}{{line.level}}"><span>{{line.level}}</span></td><td class="{{color_template}}{{line.level}}">{{line.message}}</td></tr>
{% endfor %}
</table>
</div>