Commit f80b7eef authored by 金凯强's avatar 金凯强 🎨

获取日志支持时间

parent 20726c97
Pipeline #21253 passed with stage
in 23 seconds
......@@ -50,4 +50,5 @@ class InfoAPI(ApiController):
获取日志信息
:return:
'''
return InfoService().get_install_logs()
\ No newline at end of file
args = request.args
return InfoService().get_install_logs(args)
\ No newline at end of file
# -*- coding:utf-8 -*-
import datetime
import os
import shutil
import time
......@@ -205,12 +206,19 @@ where A.log_id={log_id}'''
return page_data
def get_install_logs(self):
def get_install_logs(self, args):
'''
获取升级日志
:return:
'''
logs = docker_client.logs('install_api',tail=200)
since_time = args.get('since_time', None)
if isinstance(since_time, str):
since_time = datetime.datetime.strptime(since_time, "%Y-%m-%d %H:%M:%S")
else:
since_time = None
logs = docker_client.logs('install_api', tail=200, since=since_time)
if isinstance(logs, bytes):
logs = logs.decode()
return logs
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