Commit 0c402bd4 authored by liyang's avatar liyang

fix:解决不同操作系统路径分隔符不一致问题

parent 98db12f4
# 日志文件路径 # 日志文件路径
def get_log_path(): def get_log_path():
return "./" return "../"
...@@ -150,8 +150,8 @@ def reptile(browser=None, search_word=""): ...@@ -150,8 +150,8 @@ def reptile(browser=None, search_word=""):
# upload_control() # upload_control()
# 保存json文件到本地 # 保存json文件到本地
log.debug(os.path.abspath("./")) log.debug(os.path.abspath("../"))
file_dir = f'{os.path.join(os.path.abspath("./"),"reptile_data","ptt",str(int(time.time()))+".json")}' file_dir = f'{os.path.join(os.path.abspath("../"),"network-assets-reptile","reptile_data","ptt",str(int(time.time()))+".json")}'
# file_dir = f'./reptile_data/ptt/{int(time.time())}.json' # file_dir = f'./reptile_data/ptt/{int(time.time())}.json'
state_save = save_json(file_dir, data) state_save = save_json(file_dir, data)
log.debug("-----------------------------") log.debug("-----------------------------")
......
...@@ -7,12 +7,11 @@ from config.settings import get_log_path ...@@ -7,12 +7,11 @@ from config.settings import get_log_path
class MyLogger(Logger): class MyLogger(Logger):
def __init__(self): def __init__(self):
# log_name = '{}.log'.format(time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime())) # log_name = '{}.log'.format(time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime()))
# log_path_file = os.path.join(get_log_path(), log_name) # log_path_file = os.path.join(get_log_path(), log_name)
# 获取日志文件路径 # 获取日志文件路径
all_log_path_file = os.path.join(os.path.abspath(get_log_path()), "app.log") all_log_path_file = os.path.join(os.path.abspath(get_log_path()), "network-assets-reptile", "app.log")
error_log_path_file = os.path.join(os.path.abspath(get_log_path()), "error.log") error_log_path_file = os.path.join(os.path.abspath(get_log_path()), "network-assets-reptile", "error.log")
print(f'log file path:{all_log_path_file}') print(f'log file path:{all_log_path_file}')
# 设置日志的名字、日志的收集级别 # 设置日志的名字、日志的收集级别
super().__init__("test_api", logging.DEBUG) super().__init__("test_api", logging.DEBUG)
......
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