Created a Status Log page, Linked to 500 Template

Issue #451
This commit is contained in:
Hemanth Kumar Veeranki 2016-07-17 19:57:26 +05:30 committed by James Valleroy
parent ea47454f90
commit 8d5ef42b73
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
4 changed files with 45 additions and 0 deletions

View File

@ -71,3 +71,14 @@ def manual(request):
request, 'help_manual.html',
{'title': _('{box_name} Manual').format(box_name=_(cfg.box_name)),
'content': content})
def status_logs(request):
X = 100
file = open(cfg.status_log_file,"r")
data = file.readlines()
data = "".join(data[-X:])
context = {
"X":X,
"data":data
}
return TemplateResponse(request, "statuslog.html", context)

View File

@ -0,0 +1,32 @@
{% extends 'help_base.html' %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not,see
<http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% load i18n %}
{% block content %}
<p>
{% blocktrans trimmed %}
This is the last {{ X }} lines of status log Please attatch with the bug when raising a bug.
<pre>{{ data }}</pre>
{% endblocktrans %}
</p>
{% endblock %}

View File

@ -32,4 +32,5 @@ urlpatterns = [
url(r'^help/index/$', views.index, name='index_explicit'),
url(r'^help/about/$', views.about, name='about'),
url(r'^help/manual/$', views.manual, name='manual'),
url(r'^help/status-logs',views.status_logs,name='status-logs'),
]

View File

@ -30,6 +30,7 @@
fix. Please report the error on
the <a href="https://github.com/freedombox/Plinth/issues">bug
tracker</a> so we can fix it.
Please Attatch the <a href="/plinth/help/status-logs">Status Log</a> along with the bug
{% endblocktrans %}
</p>