From ca51aa3b3edf0d77d759d280028c19b4f00f05b2 Mon Sep 17 00:00:00 2001 From: Karako Date: Mon, 21 Aug 2023 20:53:35 +0800 Subject: [PATCH] :art: add logger --- scripts/avatar.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/avatar.py b/scripts/avatar.py index 969b4ea..fc8162c 100644 --- a/scripts/avatar.py +++ b/scripts/avatar.py @@ -5,6 +5,7 @@ from typing import TypeVar import ujson as json from aiofiles import open as async_open from humps import pascalize +from logging import getLogger from model.avatar import ( AddProp, @@ -43,9 +44,12 @@ try: except ImportError: import re +logger = getLogger("scripts.avatar") + TalentType = TypeVar("TalentType", bound=Talent) OUT_DIR = PROJECT_ROOT.joinpath("out") +OUT_DIR.mkdir(parents=True, exist_ok=True) prop_type_map = { "Hp": PropType.HP, @@ -454,6 +458,7 @@ async def parse_avatar_data(lang: Lang): constellations=constellations, ) avatar_list.append(avatar) + logger.info(f"成功爬取了 {name} 的数据") async with async_open(out_path / "avatar.json", encoding="utf-8", mode="w") as file: await file.write(