mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
update
This commit is contained in:
@@ -435,7 +435,6 @@ def getNumLines(path, num, p=1):
|
||||
break
|
||||
fp.close()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
return ''
|
||||
|
||||
return "\n".join(data)
|
||||
|
||||
+20
-1
@@ -182,10 +182,27 @@ def binLog():
|
||||
os.system('rm -f ' + path + '/mysql-bin.*')
|
||||
|
||||
public.writeFile(conf, con)
|
||||
|
||||
return public.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def getErrorLog():
|
||||
args = getArgs()
|
||||
path = getDataDir()
|
||||
filename = ''
|
||||
for n in os.listdir(path):
|
||||
if len(n) < 5:
|
||||
continue
|
||||
if n == 'error.log':
|
||||
filename = path + '/' + n
|
||||
break
|
||||
if not os.path.exists(filename):
|
||||
return public.returnJson(False, '指定文件不存在!')
|
||||
if args.has_key('close'):
|
||||
public.writeFile(filename, '')
|
||||
return public.returnJson(True, '日志已清空')
|
||||
return public.getNumLines(filename, 1000)
|
||||
|
||||
|
||||
def getShowLogFile():
|
||||
file = getConf()
|
||||
content = public.readFile(file)
|
||||
@@ -811,6 +828,8 @@ if __name__ == "__main__":
|
||||
print getConf()
|
||||
elif func == 'bin_log':
|
||||
print binLog()
|
||||
elif func == 'error_log':
|
||||
print getErrorLog()
|
||||
elif func == 'show_log':
|
||||
print getShowLogFile()
|
||||
elif func == 'my_port':
|
||||
|
||||
@@ -969,8 +969,30 @@ function myLogs(){
|
||||
|
||||
setTimeout(function(){
|
||||
myLogs();
|
||||
}, 3000);
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
|
||||
//清空日志
|
||||
$(".btn-clear").click(function () {
|
||||
myPost('error_log', 'close=1', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
|
||||
setTimeout(function(){
|
||||
myLogs();
|
||||
}, 2000);
|
||||
});
|
||||
})
|
||||
|
||||
myPost('error_log', 'p=1', function(data){
|
||||
var error_body = data.data;
|
||||
if (error_body == "") {
|
||||
error_body = '当前没有日志内容!';
|
||||
}
|
||||
$("#error_log").text(error_body);
|
||||
var ob = document.getElementById('error_log');
|
||||
ob.scrollTop = ob.scrollHeight;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user