tests/dumbhttp.py
branchstable
changeset 34925 8b95e420e248
parent 31004 d05fefbb5ab3
child 34944 bf2db35a6fe7
--- a/tests/dumbhttp.py	Wed Oct 25 21:20:01 2017 +0900
+++ b/tests/dumbhttp.py	Wed Oct 25 21:21:42 2017 +0900
@@ -41,6 +41,7 @@
         help='TCP port to listen on', metavar='PORT')
     parser.add_option('-H', '--host', dest='host', default='localhost',
         help='hostname or IP to listen on', metavar='HOST')
+    parser.add_option('--logfile', help='file name of access/error log')
     parser.add_option('--pid', dest='pid',
         help='file name where the PID of the server is stored')
     parser.add_option('-f', '--foreground', dest='foreground',
@@ -52,6 +53,9 @@
 
     signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
 
+    if options.foreground and options.logfile:
+        parser.error("options --logfile and --foreground are mutually "
+                     "exclusive")
     if options.foreground and options.pid:
         parser.error("options --pid and --foreground are mutually exclusive")
 
@@ -60,4 +64,5 @@
             'daemon_postexec': options.daemon_postexec}
     service = simplehttpservice(options.host, options.port)
     server.runservice(opts, initfn=service.init, runfn=service.run,
+                      logfile=options.logfile,
                       runargs=[sys.executable, __file__] + sys.argv[1:])