diff --git a/pytchat/core_async/replaychat.py b/pytchat/core_async/replaychat.py index b6a43ac..3db6520 100644 --- a/pytchat/core_async/replaychat.py +++ b/pytchat/core_async/replaychat.py @@ -168,10 +168,10 @@ class ReplayChatAsync: async with aiohttp.ClientSession() as session: while(continuation and self._is_alive): if self._pauser.empty(): - #pauseが呼ばれて_pauserが空状態のときは一時停止する + #pause await self._pauser.get() - #resumeが呼ばれて_pauserにitemが入ったら再開する - #直後に_pauserにitem(None)を入れてブロックを防ぐ + #resume + #prohibit from blockng by putting None into _pauser. self._pauser.put_nowait(None) livechat_json = (await self._get_livechat_json(continuation, session, headers) diff --git a/pytchat/core_multithread/replaychat.py b/pytchat/core_multithread/replaychat.py index 1f7b922..87686a5 100644 --- a/pytchat/core_multithread/replaychat.py +++ b/pytchat/core_multithread/replaychat.py @@ -162,10 +162,10 @@ class ReplayChat: with requests.Session() as session: while(continuation and self._is_alive): if self._pauser.empty(): - #pauseが呼ばれて_pauserが空状態のときは一時停止する + #pause self._pauser.get() - #resumeが呼ばれて_pauserにitemが入ったら再開する - #直後に_pauserにitem(None)を入れてブロックを防ぐ + #resume + #prohibit from blockng by putting None into _pauser. self._pauser.put_nowait(None) livechat_json = ( self._get_livechat_json(continuation, session, headers) diff --git a/pytchat/mylogger.py b/pytchat/mylogger.py index 4640307..301a350 100644 --- a/pytchat/mylogger.py +++ b/pytchat/mylogger.py @@ -17,7 +17,7 @@ def get_logger(modname,mode=logging.DEBUG): logger.addHandler(handler1) #create handler2 for recording log file if mode <= logging.DEBUG: - handler2 = logging.FileHandler(filename="log.txt") + handler2 = logging.FileHandler(filename="log.txt", encoding='utf-8') handler2.setLevel(logging.ERROR) handler2.setFormatter(my_formatter) diff --git a/pytchat/processors/default/processor.py b/pytchat/processors/default/processor.py index d99cbac..123157a 100644 --- a/pytchat/processors/default/processor.py +++ b/pytchat/processors/default/processor.py @@ -4,7 +4,9 @@ from .renderer.textmessage import LiveChatTextMessageRenderer from .renderer.paidmessage import LiveChatPaidMessageRenderer from .renderer.paidsticker import LiveChatPaidStickerRenderer from .renderer.legacypaid import LiveChatLegacyPaidMessageRenderer - +from ... import config +from ... import mylogger +logger = mylogger.get_logger(__name__,mode=config.LOGGER_MODE) class Chatdata: def __init__(self,chatlist:list, timeout:float): @@ -60,8 +62,7 @@ class DefaultProcessor: renderer.get_snippet() renderer.get_authordetails() except (KeyError,TypeError,AttributeError) as e: - print(f"------{str(type(e))}-{str(e)}----------") - print(sitem) + logger.error(f"{str(type(e))}-{str(e)} sitem:{str(sitem)}") return None return renderer