Please remove hard coded usage of the root logger from the logging module
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 38/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Start by inspecting the JABWrapper import path, including JABWrapper.jab_wrapper and JABWrapper.jab_types, and search the logging calls described in the issue. Check how importing the package affects the root logger and jab_wrapper.log, then verify that users can configure the JABWrapper logger without unwanted root handlers or formatters.
索引モデルが issue の本文から書いたものです。
説明
Hi there,
Just want to begin by saying I'm eternally grateful for the release of this module as a standalone package. This is a super clean general purpose implementation of JAB.
That being said, I'd really appreciate it if the calls to the root logger could be removed in a future release. At the moment I have to do something pretty hacky to stop the JABWrapper module from adding unwanted handlers and formatters to the root logger.
def monkey_patch_logging():
"""Initial Load of JABWrapper here to prevent it from using the root logger"""
class MetaReturnsCLS(type):
def __getattr__(cls, name):
return lambda *args, **kwargs: cls
class LoggingFacade(metaclass=MetaReturnsCLS):
jab_logger = logging.getLogger("JABWrapper")
debug = jab_logger.debug
info = jab_logger.info
DEBUG = logging.DEBUG
INFO = logging.INFO
sys.modules[logging.__name__] = LoggingFacade
import JABWrapper
from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper
from JABWrapper.jab_types import JavaObject
sys.modules[logging.__name__] = logging
This is the only way I was able to both keep my logger hierarchy clean and prevent jab_wrapper.log files showing up in my project directory.
It'd be really simple to fix this issue, it'd only require that the method calls to the logging module itself be substituted with calls to a package local logger. Then, an importing user like myself could chose to enable/disable the logging therein.
import logging
# not this
logging.basicConfig(level=logging.DEBUG, handlers=[logging_file_handler, logging_stream_handler])
logging.debug("my debug message")
# do this
logger = logging.getLogger("JABWrapper")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging_file_handler)
logger.addHandler(logging_stream_handler)
logger.debug("my debug message")
Is this something you'd be willing accept pull requests on?
Thanks!
- 主要言語
- Python
- スター
- 20
- フォーク
- 8
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
robocorp/java-access-bridge-wrapper のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
robocorp/java-access-bridge-wrapper#7 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
robocorp/java-access-bridge-wrapper#5 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
robocorp/java-access-bridge-wrapper#2 · コメント 2 件 ·
robocorp/java-access-bridge-wrapper の issue をすべて見る
似ている issue
-
python-version
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug javascript P2-medium python release:v3.1
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
adrirubio/claude-deck#546 ·
メンテナーはふだん 1 日以内に返信
-
area: desktop area: website priority: P2 type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
appandflow/stim#3411 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1時間未満 初心者へのやさしさ 88/100
baptistehamon/lsapy#185 ·
メンテナーはふだん 1 日以内に返信