-
Notifications
You must be signed in to change notification settings - Fork 1.2k
logger: add trace, count --verbose/--quiet #3806
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
Conversation
| if args.quiet: | ||
| logger.setLevel(logging.CRITICAL) | ||
|
|
||
| elif args.verbose: | ||
| logger.setLevel(logging.DEBUG) | ||
| logger.setLevel( | ||
| { | ||
| -2: logging.CRITICAL, | ||
| -1: logging.ERROR, | ||
| 0: logging.INFO, | ||
| 1: logging.DEBUG, | ||
| 2: logging.TRACE, | ||
| }[max(-2, min(args.verbose - args.quiet, 2))] | ||
| ) | ||
| logger.trace(args) |
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.
this pretty much summarises this PR.
| "TRACE": colorama.Fore.GREEN, | ||
| "DEBUG": colorama.Fore.BLUE, | ||
| "WARNING": colorama.Fore.YELLOW, | ||
| "ERROR": colorama.Fore.RED, |
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.
not particularly fussed about colours - feel free to suggest others
Makes testing easier
We only disable loggers on cli commands. |
|
We could still merge this and if/when a user takes issue with this we can look into work-arounds. Really using DVC API + another package which adds a logging level other than the fairly common |
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.
agree with @casperdcl, even if defining custom log levels isn't recommended for libraries, it makes sense for us to have a trace level in DVC, and it seems pretty unlikely that it will actually cause any issues in the future.
Part of the issue is a bug from iterative#3806 Kudos to @karajan1001 for finding this bug while working on iterative#4282
Part of the issue is a bug from #3806 Kudos to @karajan1001 for finding this bug while working on #4282
-q/-vCLI flags to determine verbositytrace/TRACElogging level (more verbose thandebug)debuglogging totrace-- https://docs.python.org/3/howto/logging.html#custom-levels
-- @casperdcl