Skip to content

Commit

Permalink
Merge pull request #21 from Drelf2018/fix
Browse files Browse the repository at this point in the history
fix: 修复连接直播间时重复添加 handler 导致重复输出的错误
  • Loading branch information
Nemo2011 authored Jul 12, 2022
2 parents 36de665 + 09bb6f0 commit 69b55d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

1. 使用 `git clone git@github.com:Nemo2011/bilibili_api.git` 将本仓库拉取到本地。
2. 使用 `cd bilibili-api` 切换到仓库位置。
3. 使用 `python -r requirements.txt` 安装相关依赖。
3. 使用 `pip install -r requirements.txt` 安装相关依赖。
4. **使用 `python install.py` 进行初始化**,该项非常重要,将会初始化 Git Hooks。
5. 使用 `git checkout dev && git checkout -b {分支名}` 从 dev 分支切换到一个新的分支再进行编码。
6. 开发完毕后,使用 `git push -u origin {分支名}` 将分支推送到你 fork 的仓库。
Expand Down
13 changes: 7 additions & 6 deletions bilibili_api/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,14 @@ def __init__(
# logging
self.logger = logging.getLogger(f"LiveDanmaku_{self.room_display_id}")
self.logger.setLevel(logging.DEBUG if debug else logging.INFO)
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter(
"[" + str(room_display_id) + "][%(asctime)s][%(levelname)s] %(message)s"
if not self.logger.handlers:
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter(
"[" + str(room_display_id) + "][%(asctime)s][%(levelname)s] %(message)s"
)
)
)
self.logger.addHandler(handler)
self.logger.addHandler(handler)

def get_status(self):
"""
Expand Down

0 comments on commit 69b55d1

Please sign in to comment.