mirror of https://github.com/dirtbags/moth.git
Add logging flags to the devel server
This commit is contained in:
parent
08bba4fa64
commit
107aa5e736
|
@ -265,12 +265,24 @@ if __name__ == '__main__':
|
||||||
'--base', default="",
|
'--base', default="",
|
||||||
help="Base URL to this server, for reverse proxy setup"
|
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()
|
args = parser.parse_args()
|
||||||
parts = args.bind.split(":")
|
parts = args.bind.split(":")
|
||||||
addr = parts[0] or "0.0.0.0"
|
addr = parts[0] or "0.0.0.0"
|
||||||
port = int(parts[1])
|
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 = MothServer((addr, port), MothRequestHandler)
|
||||||
server.args["base_url"] = args.base
|
server.args["base_url"] = args.base
|
||||||
|
|
Loading…
Reference in New Issue