log update 03

This commit is contained in:
13339479676 2022-01-15 15:54:17 +08:00
parent a4e44bf6be
commit 83a9442cbf
1 changed files with 13 additions and 6 deletions

View File

@ -5,14 +5,21 @@
import sys
# def is_logSuffix(logName):
# suffixList = ['log', 'txt', 'data'] # 日志后缀列表
# logSuffixFlag = 0 # 日志后缀标志
# for i in range(len(suffixList)):
# # 查找日志后缀
# if logName.endswith(suffixList[i]):
# logSuffixFlag = 1
# if logSuffixFlag == 0:
# print(f'日志格式不正确!程序结束!')
# sys.exit() # 结束程序
def is_logSuffix(logName):
suffixList = ['log', 'txt', 'data'] # 日志后缀列表
logSuffixFlag = 0 # 日志后缀标志
for i in range(len(suffixList)):
# 查找日志后缀
if logName.endswith(suffixList[i]):
logSuffixFlag = 1
if logSuffixFlag == 0:
log_suffix = logName.split('.')[-1]
if log_suffix not in suffixList:
print(f'日志格式不正确!程序结束!')
sys.exit() # 结束程序