1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-07-07 05:17:58 +08:00
This commit is contained in:
positnuec
2026-07-03 00:43:03 +08:00
42 changed files with 222 additions and 87 deletions

View File

@@ -171,26 +171,7 @@ os.chdir(os.path.join(os.path.dirname(__file__), '../'))
pyw_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
def _set_file_logger(name=pyw_name):
if '_' in name:
name = name.split('_', 1)[0]
log_file = f'./log/{datetime.date.today()}_{name}.txt'
try:
file = logging.FileHandler(log_file, encoding='utf-8')
except FileNotFoundError:
os.mkdir('./log')
file = logging.FileHandler(log_file, encoding='utf-8')
file.setFormatter(file_formatter)
logger.handlers = [h for h in logger.handlers if not isinstance(
h, (logging.FileHandler, RichFileHandler))]
logger.addHandler(file)
logger.log_file = log_file
def set_file_logger(name=pyw_name):
if '_' in name:
name = name.split('_', 1)[0]
log_file = f'./log/{datetime.date.today()}_{name}.txt'
try:
file = open(log_file, mode='a', encoding='utf-8')