From 107aa5e7369837064fa2046cc5125481ad675aa3 Mon Sep 17 00:00:00 2001 From: John Donaldson Date: Wed, 30 Oct 2019 15:40:36 +0000 Subject: [PATCH] Add logging flags to the devel server --- devel/devel-server.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/devel/devel-server.py b/devel/devel-server.py index 438c0e8..05828fb 100755 --- a/devel/devel-server.py +++ b/devel/devel-server.py @@ -265,12 +265,24 @@ if __name__ == '__main__': '--base', default="", help="Base URL to this server, for reverse proxy setup" ) + parser.add_argument( + "-v", "--verbose", + action="count", + default=1, # Leave at 1, for now, to maintain current default behavior + help="Include more verbose logging. Use multiple flags to increase level", + ) args = parser.parse_args() parts = args.bind.split(":") addr = parts[0] or "0.0.0.0" port = int(parts[1]) + if args.verbose >= 2: + log_level = logging.DEBUG + elif args.verbose == 1: + log_level = logging.INFO + else: + log_level = logging.WARNING - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=log_level) server = MothServer((addr, port), MothRequestHandler) server.args["base_url"] = args.base