thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.82k stars 352 forks source link

logger.info don't display when run with `--verbose` option #634

Open snowman opened 3 years ago

snowman commented 3 years ago

https://github.com/thp/urlwatch/blob/b9a5487c87ee4a61657fbff2811558ab6a87e691/lib/urlwatch/util.py#L71

https://github.com/thp/urlwatch/blob/b9a5487c87ee4a61657fbff2811558ab6a87e691/lib/urlwatch/cli.py#L95

Because method __init__ in metaclass TrackSubClasses in file util.py is run before function setup_logger(verbose) in file cli.py

The trackback with

import traceback
print('\n'.join(traceback.format_stack()))
logger.error('Registering %r as %s', cls, cls.__kind__)
  File "/path/bin/urlwatch", line 5, in <module>
    from urlwatch.cli import main

  File "/path/lib/python3.9/site-packages/urlwatch/cli.py", line 54, in <module>
    from urlwatch.command import UrlwatchCommand

  File "/path/lib/python3.9/site-packages/urlwatch/command.py", line 38, in <module>
    from .filters import FilterBase

  File "/path/lib/python3.9/site-packages/urlwatch/filters.py", line 268, in <module>
    class BeautifyFilter(FilterBase):

  File "/path/lib/python3.9/site-packages/urlwatch/util.py", line 71, in __init__
    print('\n'.join(traceback.format_stack()))