python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Logging messages don't using logging

Open bovlb opened this issue 4 years ago • 4 comments

https://github.com/google/python-fire/blob/c1266d0dbb2114514fcf8be62044344b5a51c733/fire/core.py#L239 https://github.com/google/python-fire/blob/c1266d0dbb2114514fcf8be62044344b5a51c733/fire/core.py#L287

When I get the help message, includes INFO: messages like: INFO: Showing help with the command {cmd}

I would like such logging messages to use Python's logging framework which would allow me to suppress and redirect such messages.

bovlb avatar Aug 26 '21 19:08 bovlb

Until this is fixed, you could use the following dirty hack to suppress these:

def _print(*args, **kwargs):
    args = [arg for arg in args
            if not isinstance(arg, str) or not arg.startswith('INFO: Showing help')]
    if not args:
        return
    print(*args, **kwargs)
fire.core.print = _print

melsabagh avatar Sep 26 '21 21:09 melsabagh

is this issue up for grabs? I would love to work on it.

dravog7 avatar Oct 08 '21 11:10 dravog7

We'd like to fix this such that for the typical user (who doesn't configure any logging settings), the behavior is the same as it currently is, with the INFO logs being displayed appropriately.

@dravog7 Yes, this issue is not currently being worked on and you are welcome to work on it if you are still interested in doing so.

dbieber avatar Apr 16 '22 21:04 dbieber

I will work on this

ordas21 avatar Apr 29 '22 02:04 ordas21