-
-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 iterable And 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 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last minute check :)
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.