🎨 add logger

This commit is contained in:
Karako 2023-08-21 20:53:35 +08:00
parent 695851fcc1
commit ca51aa3b3e
No known key found for this signature in database

View File

@ -5,6 +5,7 @@ from typing import TypeVar
import ujson as json import ujson as json
from aiofiles import open as async_open from aiofiles import open as async_open
from humps import pascalize from humps import pascalize
from logging import getLogger
from model.avatar import ( from model.avatar import (
AddProp, AddProp,
@ -43,9 +44,12 @@ try:
except ImportError: except ImportError:
import re import re
logger = getLogger("scripts.avatar")
TalentType = TypeVar("TalentType", bound=Talent) TalentType = TypeVar("TalentType", bound=Talent)
OUT_DIR = PROJECT_ROOT.joinpath("out") OUT_DIR = PROJECT_ROOT.joinpath("out")
OUT_DIR.mkdir(parents=True, exist_ok=True)
prop_type_map = { prop_type_map = {
"Hp": PropType.HP, "Hp": PropType.HP,
@ -454,6 +458,7 @@ async def parse_avatar_data(lang: Lang):
constellations=constellations, constellations=constellations,
) )
avatar_list.append(avatar) avatar_list.append(avatar)
logger.info(f"成功爬取了 {name} 的数据")
async with async_open(out_path / "avatar.json", encoding="utf-8", mode="w") as file: async with async_open(out_path / "avatar.json", encoding="utf-8", mode="w") as file:
await file.write( await file.write(