From 2c0231155d0f982d1acdb172e389d5628a9b906b Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 20 Sep 2022 11:30:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/files_api.py | 2 +- class/core/site_api.py | 4 ++-- plugins/mariadb/index.py | 2 +- plugins/mysql/index.py | 2 +- plugins/supervisor/index.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/core/files_api.py b/class/core/files_api.py index bc97a1482..63a73783c 100755 --- a/class/core/files_api.py +++ b/class/core/files_api.py @@ -36,7 +36,7 @@ class files_api: return mw.returnJson(False, '文件不存在', (path,)) try: - data = mw.getNumLines(path, int(line)) + data = mw.getLastLine(path, int(line)) return mw.returnJson(True, 'OK', data) except Exception as ex: return mw.returnJson(False, u'无法正确读取文件!' + str(ex)) diff --git a/class/core/site_api.py b/class/core/site_api.py index 40f1ac30d..c91e8749d 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -1829,13 +1829,13 @@ location ^~ {from} { logPath = mw.getLogsDir() + '/' + siteName + '.log' if not os.path.exists(logPath): return mw.returnJson(False, '日志为空') - return mw.returnJson(True, mw.getNumLines(logPath, 100)) + return mw.returnJson(True, mw.getLastLine(logPath, 100)) def getErrorLogs(self, siteName): logPath = mw.getLogsDir() + '/' + siteName + '.error.log' if not os.path.exists(logPath): return mw.returnJson(False, '日志为空') - return mw.returnJson(True, mw.getNumLines(logPath, 100)) + return mw.returnJson(True, mw.getLastLine(logPath, 100)) # 取日志状态 def getLogsStatus(self, siteName): diff --git a/plugins/mariadb/index.py b/plugins/mariadb/index.py index 4d3e9a8c1..279e28813 100755 --- a/plugins/mariadb/index.py +++ b/plugins/mariadb/index.py @@ -304,7 +304,7 @@ def getErrorLog(): if 'close' in args: mw.writeFile(filename, '') return mw.returnJson(False, '日志已清空') - info = mw.getNumLines(filename, 18) + info = mw.getLastLine(filename, 18) return mw.returnJson(True, 'OK', info) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index d6fd083ed..d4f9cf8ed 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -333,7 +333,7 @@ def getErrorLog(): if 'close' in args: mw.writeFile(filename, '') return mw.returnJson(False, '日志已清空') - info = mw.getNumLines(filename, 18) + info = mw.getLastLine(filename, 18) return mw.returnJson(True, 'OK', info) diff --git a/plugins/supervisor/index.py b/plugins/supervisor/index.py index 1d7c06758..7172170fe 100755 --- a/plugins/supervisor/index.py +++ b/plugins/supervisor/index.py @@ -472,7 +472,7 @@ def readConfigLogTpl(): stdout_logfile = line.strip().split('=')[1] if stdout_logfile != '': - data = mw.getNumLines(stdout_logfile, int(line_log)) + data = mw.getLastLine(stdout_logfile, int(line_log)) return mw.returnJson(True, 'OK', data) return mw.returnJson(False, 'OK', '') @@ -494,7 +494,7 @@ def readConfigLogErrorTpl(): stderr_logfile = line.strip().split('=')[1] if stderr_logfile != '': - data = mw.getNumLines(stderr_logfile, int(line_log)) + data = mw.getLastLine(stderr_logfile, int(line_log)) return mw.returnJson(True, 'OK', data) return mw.returnJson(False, 'OK', '')