Skip to content

Commit

Permalink
argparser: added command --loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
back-to committed Jan 17, 2021
1 parent 9baab5a commit 8a9848b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions liveproxy/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ def func(value):
Show version number and exit.
'''
)
general.add_argument(
'--loglevel',
metavar='LEVEL',
choices=('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'),
default='INFO',
help='''
Set the log message threshold.
https://docs.python.org/3/library/logging.html#logging-levels
Valid levels are: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET
'''
)

server = parser.add_argument_group('Server options')
server.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion liveproxy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main():

logging.basicConfig(
stream=sys.stdout,
level='DEBUG',
level=args.loglevel,
format='[%(name)s][%(levelname)s] %(message)s',
)

Expand Down

0 comments on commit 8a9848b

Please sign in to comment.