fixed log中token脱敏

This commit is contained in:
“xxq250” 2022-08-10 18:16:45 +08:00
parent 40cf09bede
commit 9c474fa46e
1 changed files with 10 additions and 0 deletions

View File

@ -300,8 +300,18 @@ class Job(Controller):
raise ErrorTemplate.ARGUMENT_LACK("工程名")
if not id:
raise ErrorTemplate.ARGUMENT_LACK("同步流id")
project_service = ProjectService()
projects = await project_service.search_project(name=name)
if len(project) == 0:
raise ErrorTemplate.ARGUMENT_ERROR("工程名")
service = LogService()
log = await service.get_logs_by_job(id)
data = []
for rep_log in log:
rep_log.log.replace(projects[0].gitee_token, "******").replace(projects[0].github_token, "******")
data.append(rep_log)
return data
if len(log) == 0:
logger.info(
f"The job #{id} of project #{name} has no logs")