Add ability to enable debug logging by commandline argument

This commit is contained in:
milaq 2019-08-18 13:51:07 +02:00
parent 16387a3f50
commit 895a5aa37f

View file

@ -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)