X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=python3%2Fscgi-wsgi3;h=4242d10fbadb46a241ebd2102ca7059837975ef4;hp=4f5714e8bc9709cc49a7a1adfccbe7b4af1cb3bc;hb=78c8462c86c6043c7326bee7ebdf754e01d641c9;hpb=c329061e49e3e62619200dd4ef61f7c096337d72 diff --git a/python3/scgi-wsgi3 b/python3/scgi-wsgi3 index 4f5714e..4242d10 100755 --- a/python3/scgi-wsgi3 +++ b/python3/scgi-wsgi3 @@ -1,23 +1,27 @@ #!/usr/bin/python3 -import sys, os, getopt +import sys, os, getopt, logging import socket import ashd.scgi def usage(out): - out.write("usage: scgi-wsgi3 [-hA] [-p MODPATH] [-T [HOST:]PORT] HANDLER-MODULE [ARGS...]\n") + out.write("usage: scgi-wsgi3 [-hAL] [-p MODPATH] [-T [HOST:]PORT] HANDLER-MODULE [ARGS...]\n") sk = None modwsgi_compat = False -opts, args = getopt.getopt(sys.argv[1:], "+hAp:T:") +setlog = True +opts, args = getopt.getopt(sys.argv[1:], "+hALp:T:") for o, a in opts: if o == "-h": usage(sys.stdout) sys.exit(0) elif o == "-p": sys.path.insert(0, a) + elif o == "-L": + setlog = False elif o == "-T": sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sk.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) p = a.rfind(":") if p < 0: bindhost = "localhost" @@ -32,6 +36,8 @@ for o, a in opts: if len(args) < 1: usage(sys.stderr) sys.exit(1) +if setlog: + logging.basicConfig(format="ashd-wsgi(%(name)s): %(levelname)s: %(message)s") if sk is None: # This is suboptimal, since the socket on stdin is not necessarily