pull/109/head
Mr Chen 6 years ago
parent 9c6d64c48b
commit 68dbe5a5de
  1. 1
      class/core/public.py
  2. 21
      plugins/mysql/index.py
  3. 24
      plugins/mysql/js/mysql.js

@ -435,7 +435,6 @@ def getNumLines(path, num, p=1):
break break
fp.close() fp.close()
except Exception as e: except Exception as e:
print str(e)
return '' return ''
return "\n".join(data) return "\n".join(data)

@ -182,10 +182,27 @@ def binLog():
os.system('rm -f ' + path + '/mysql-bin.*') os.system('rm -f ' + path + '/mysql-bin.*')
public.writeFile(conf, con) public.writeFile(conf, con)
return public.returnJson(True, '设置成功!') 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(): def getShowLogFile():
file = getConf() file = getConf()
content = public.readFile(file) content = public.readFile(file)
@ -811,6 +828,8 @@ if __name__ == "__main__":
print getConf() print getConf()
elif func == 'bin_log': elif func == 'bin_log':
print binLog() print binLog()
elif func == 'error_log':
print getErrorLog()
elif func == 'show_log': elif func == 'show_log':
print getShowLogFile() print getShowLogFile()
elif func == 'my_port': elif func == 'my_port':

@ -969,8 +969,30 @@ function myLogs(){
setTimeout(function(){ setTimeout(function(){
myLogs(); 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;
});
}); });
} }

Loading…
Cancel
Save