logger: add trace, count --verbose/--quiet#3806
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.
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.
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 |
pmrowla
left a comment
There was a problem hiding this comment.
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 treeverse#3806 Kudos to @karajan1001 for finding this bug while working on treeverse#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