diff --git a/app.py b/app.py index ea30432..0c2128f 100644 --- a/app.py +++ b/app.py @@ -202,8 +202,8 @@ def get_info(): return json_dump -@app.route('/get_log') -def get_log(): +@app.route('/get_access_log') +def get_access_log(): file = open('/var/log/v2ray/access.log',"r") content = file.read().split("\n") min_length = min(20,len(content)) @@ -213,6 +213,18 @@ def get_log(): string = string + content[i] + "
" return string +@app.route('/get_error_log') +def get_error_log(): + file = open('/var/log/v2ray/error.log',"r") + content = file.read().split("\n") + min_length = min(20,len(content)) + content = content[-min_length:] + string = "" + for i in range(min_length): + string = string + content[i] + "
" + return string + + @app.route('/gen_ssl',methods=['GET', 'POST']) def gen_ssl(): diff --git a/templates/log.html b/templates/log.html index d462c56..04f504e 100644 --- a/templates/log.html +++ b/templates/log.html @@ -23,11 +23,11 @@ + c0.8,0.1,1.1-0.4,1.1-0.8c0-0.4,0-1.4,0-2.8c-4.5,1-5.5-2.2-5.5-2.2c-0.7-1.9-1.8-2.4-1.8-2.4c-1.5-1,0.1-1,0.1-1 + c1.6,0.1,2.5,1.7,2.5,1.7c1.5,2.5,3.8,1.8,4.7,1.4c0.1-1.1,0.6-1.8,1-2.2c-3.6-0.4-7.4-1.8-7.4-8.1c0-1.8,0.6-3.2,1.7-4.4 + c-0.2-0.4-0.7-2.1,0.2-4.3c0,0,1.4-0.4,4.5,1.7c1.3-0.4,2.7-0.5,4.1-0.5c1.4,0,2.8,0.2,4.1,0.5c3.1-2.1,4.5-1.7,4.5-1.7 + c0.9,2.2,0.3,3.9,0.2,4.3c1,1.1,1.7,2.6,1.7,4.4c0,6.3-3.8,7.6-7.4,8c0.6,0.5,1.1,1.5,1.1,3c0,2.2,0,3.9,0,4.5 + c0,0.4,0.3,0.9,1.1,0.8c6.5-2.2,11.1-8.3,11.1-15.5C34.3,8.7,27,1.4,18,1.4z"> @@ -60,7 +60,7 @@ - - - - - + + + +
+
运行日志 (实时刷新)
@@ -73,14 +73,20 @@
-
-
-
-
+
+ access.log +
+
+
+
+ error.log +
+
+
@@ -94,7 +100,8 @@ function timer() { - $('#log-content').load('/get_log'); + $('#log-access-content').load('/get_access_log'); + $('#log-error-content').load('/get_error_log'); var t=setTimeout("timer()",1500); } timer()