Skip to content

Commit

Permalink
More verbose options
Browse files Browse the repository at this point in the history
  • Loading branch information
max2697 committed Mar 31, 2024
1 parent 9f3cdff commit a233a11
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 554 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ pytest

# Run demo
python src/demo.py --help
# To output debug logs to a file, change DEBUG_LOG_RESPONSE to True in opower.py and run:
python src/demo.py --verbose 2> out.txt
# To output debug logs to a file run:
python src/demo.py -vv 2> out.txt

# Build package
python -m pip install build
Expand Down
6 changes: 4 additions & 2 deletions src/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ async def _main() -> None:
action="store_true",
)
parser.add_argument(
"-v", "--verbose", help="enable verbose logging", action="store_true"
"-v", "--verbose", help="enable verbose logging", action="count", default=0
)
args = parser.parse_args()

logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
logging.basicConfig(
level=logging.DEBUG - args.verbose + 1 if args.verbose > 0 else logging.INFO
)

utility = args.utility or input(f"Utility, one of {supported_utilities}: ")
username = args.username or input("Username: ")
Expand Down
Loading

0 comments on commit a233a11

Please sign in to comment.