Commit 3428512e authored by Marc Duez's avatar Marc Duez

server : admin : log controller

parent a33f857a
......@@ -4,10 +4,10 @@ from subprocess import *
def fuse(cmd, output_dir, filename):
import time, datetime, sys, os.path, random
from subprocess import Popen, PIPE, STDOUT, os
fuse_log_file = open(output_dir+'/'+filename+'.fuse.log', 'w')
output_file = output_dir+'/'+filename+'.fused'
## fuse.py
p = Popen(cmd, shell=True, stdin=PIPE, stdout=fuse_log_file, stderr=STDOUT, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
......@@ -16,10 +16,11 @@ def fuse(cmd, output_dir, filename):
return fuse_filepath
def main():
server = SimpleXMLRPCServer(("localhost", 12345))
server = SimpleXMLRPCServer(("localhost", 12345))
server.register_function(fuse, "fuse")
while True:
server.handle_request()
if __name__ == "__main__":
main()
\ No newline at end of file
main()
# coding: utf8
import gluon.contrib.simplejson
import gluon.contrib.simplejson, re
import os.path
if request.env.http_origin:
......@@ -16,6 +16,53 @@ def index():
def worker():
if auth.has_membership("admin"):
return dict(message=T(''))
def log():
if auth.has_membership("admin"):
lines = []
file = open('/var/vidjil/'+request.vars["file"])
for row in reversed(file.readlines()) :
flag = True
if "filter" in request.vars :
filter_list = request.vars["filter"].split(' ')
for f in filter_list :
if row.lower().find(f.lower()) == -1 :
flag = False
else :
request.vars["filter"] = ""
if flag :
line = {}
tmp = re.split('\t+| +', row)
line["date"] = tmp[1]
line["date2"] = tmp[2].split(',')[0]
line["type"] = tmp[3]
line["file"] = tmp[5]
if tmp[6] != "Creating":
line["user"] = tmp[7]
line["mes"] = ""
for i in range(8,len(tmp)):
line["mes"] += tmp[i] + " "
else:
line["user"] = ""
line["mes"] = ""
for i in range(6,len(tmp)):
line["mes"] += tmp[i] + " "
lines.append(line)
if len(lines) >= 100 :
return dict(lines = lines)
return dict(lines = lines
)
## to use after change in the upload folder
def repair_missing_files():
......
......@@ -8,3 +8,9 @@ Bientot vous trouverez içi un magnifique panneau d'administration, en attendant
</br>
<a class="button" onclick="db.call('admin/repair_missing_files');">fix missing files problem</a>
</br>
<a class="button" onclick="db.call('admin/log', {'file' : 'vidjil.log'} );">log</a>
</br>
<a class="button" onclick="db.call('admin/log', {'file' : 'vidjil-debug.log'} );">debug log</a>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment