aboutsummaryrefslogtreecommitdiffhomepage
path: root/views/logs.tpl
blob: b8ec92f0a0b1dd363392ae4205def62e6fc8a4e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
	<head>
		<!DOCTYPE html>
		<script src="{{base_url}}static/jquery/jquery-latest.min.js"></script>
		<script src="{{base_url}}static/semantic/semantic.min.js"></script>
		<script src="{{base_url}}static/jquery/tablesort.js"></script>
		<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">

		<style>
			body {
				background-color: #272727;
			}
		</style>
	</head>
	<body>
		<div id='logs_loader' class="ui page dimmer">
		   	<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
		</div>
		<div class="content">
			<table class="ui very basic selectable table">
				<thead>
					<tr>
						<th class="collapsing"></th>
						<th>Message</th>
						<th class="collapsing">Time</th>
					</tr>
				</thead>
				<tbody>
				%import time
				%import datetime
				%import pretty
				%for log in logs:
					%line = []
					%line = log.split('|')
					<tr class='log' data-message="\\
%try:
{{line[3]}}\\
%except:
\\
%end
" data-exception="\\
%try:
{{line[4]}}\\
%except:
\\
%end
">
						<td class="collapsing"><i class="\\
%try:
%if line[1] == 'INFO    ':
blue info circle icon \\
%elif line[1] == 'WARNING ':
yellow warning circle icon \\
%elif line[1] == 'ERROR   ':
red bug icon \\
%elif line[1] == 'DEBUG   ':
bug icon \\
%end
%except:
%pass
%end
"></i></td>
						<td>\\
%try:
{{line[3]}}\\
%except:
\\
%end
</td>
						<td title="\\
%try:
{{line[0]}}" class="collapsing">{{pretty.date(int(time.mktime(datetime.datetime.strptime(line[0], "%d/%m/%Y %H:%M:%S").timetuple())))}}</td>
%except:
" class="collapsing"></td>
%end
					</tr>
				%end
				</tbody>
			</table>
		</div>

		<div id="modal" class="ui small modal">
			<i class="close icon"></i>
			<div class="header">
				<div>Details</div>
			</div>
			<div class="content">
				Message
				<div id='message' class="ui segment">
					<p></p>
				</div>
				Exception
				<div id='exception' class="ui segment">
					<p></p>
				</div>
			</div>
			<div class="actions">
				<button class="ui cancel button" >Close</button>
			</div>
		</div>
	</body>
</html>

<script>
	$('.modal')
		.modal({
	    	autofocus: false
		})
	;

	$('.log').click(function(){
		$("#message").html($(this).data("message"));
		exception = $(this).data("exception");
		exception = exception.replace(/'/g,"");
		exception = exception.replace(/\\n\s\s\s\s/g, "\\n&emsp;&emsp;");
		exception = exception.replace(/\\n\s\s/g, "\\n&emsp;");
		exception = exception.replace(/\\n/g, "<br />")
		$("#exception").html(exception);
		$('#modal').modal('show');
	})
</script>