modify scripts
This commit is contained in:
@ -14,6 +14,7 @@ global_share_data_dir = f'{home_dir}/sharedata'
|
||||
log_count = defaultdict(int) # 记录日志的次数
|
||||
last_log_time = defaultdict(float) # 记录上次写入的时间戳
|
||||
|
||||
log_dir = '../log'
|
||||
class RateLimitFilter(logging.Filter):
|
||||
"""
|
||||
频率限制过滤器:
|
||||
@ -50,7 +51,9 @@ def setup_logging(log_filename=None):
|
||||
caller_frame = inspect.stack()[1]
|
||||
caller_filename = os.path.splitext(os.path.basename(caller_frame.filename))[0]
|
||||
current_date = datetime.now().strftime('%Y%m%d')
|
||||
log_filename = f'../log/{caller_filename}_{current_date}.log'
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
log_filename = f'{log_dir}/{caller_filename}_{current_date}.log'
|
||||
#log_filename = f'../log/{caller_filename}_{current_date}.log'
|
||||
|
||||
max_log_size = 100 * 1024 * 1024 # 10 MB
|
||||
max_log_files = 10 # 最多保留 10 个日志文件
|
||||
|
||||
Reference in New Issue
Block a user