Support setting output verbosity#889
Conversation
This changes the internal use of echo to use a logger instead of sys.stdout.write. This uses the stdlib logging library, with the common convention of logger = logging.getLogger(__name__), so that all watchdog logs are under the "watchdog" logging context. Finally, this adds -q/--quiet and -v/--verbose command line options to watchmedo.
|
Thanks @taleinat :) When running Traceback (most recent call last):
File "/bin/watchmedo", line 33, in <module>
sys.exit(load_entry_point('watchdog', 'console_scripts', 'watchmedo')())
File "src/watchdog/watchmedo.py", line 650, in main
verbosity = sum(args.verbosity)
TypeError: 'NoneType' object is not iterableAnd would you mind adding some documentation in the README + a line in the changelog? And at least one test would be awesome ^^ |
|
Done as suggested, @BoboTiG. Regarding adding to the README, it currently gives two examples of running |
|
You are right 👍 |
|
I am OK to merge if you are done. |
|
I'm done, so if you've reviewed the latest changes and are okay with them, let's merge :) |
|
Please wait before merging... |
|
I've made the code use a specific custom exception rather than raising Exception. Ready now as far as I'm concerned. |
|
Perfect! Thanks a lot 🍾 🎊 |
|
Excellent! Any plans for a release soon? |
|
Well, right now seems a good time ;) EDIT: build in progress ... |
This changes the internal use of echo to use a logger instead of
sys.stdout.write.This uses the stdlib logging library, with the common convention of
logger = logging.getLogger(__name__), so that all watchdog logs are under the "watchdog" logging context. This allows code using watchdog to easily change the logging level of watchdog code via e.g.logging.getLogger("watchdog").setLevel("ERROR").Finally, this adds -q/--quiet and -v/--verbose command line options to watchmedo.
Fixes #594.
P.S. This also makes watchmedo exit with a nonzero return code when a command is not provided or when -v or -q are supplied too many times.