From 895a5aa37fdce274d81a809d392674368a581929 Mon Sep 17 00:00:00 2001 From: milaq Date: Sun, 18 Aug 2019 13:51:07 +0200 Subject: [PATCH] Add ability to enable debug logging by commandline argument --- ycast/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ycast/__main__.py b/ycast/__main__.py index 05444a5..3d80462 100755 --- a/ycast/__main__.py +++ b/ycast/__main__.py @@ -14,7 +14,11 @@ def launch_server(): parser.add_argument('-c', action='store', dest='config', help='Station configuration', default=None) parser.add_argument('-l', action='store', dest='address', help='Listen address', default='0.0.0.0') parser.add_argument('-p', action='store', dest='port', type=int, help='Listen port', default=80) + parser.add_argument('-d', action='store_true', dest='debug', help='Enable debug logging') arguments = parser.parse_args() + if arguments.debug: + logging.getLogger().setLevel(logging.DEBUG) + logging.debug("Debug logging enabled") logging.info("YCast server starting on %s:%s" % (arguments.address, arguments.port)) server.run(arguments.config, arguments.address, arguments.port)