diff --git a/emmett/_reloader.py b/emmett/_reloader.py index dcaf34d0..f3edd2f0 100644 --- a/emmett/_reloader.py +++ b/emmett/_reloader.py @@ -155,6 +155,7 @@ def run_with_reloader( port, loop='auto', log_level=None, + log_access=False, threads=1, threading_mode="workers", ssl_certfile: Optional[str] = None, @@ -177,6 +178,7 @@ def run_with_reloader( kwargs={ "loop": loop, "log_level": log_level, + "log_access": log_access, "threads": threads, "threading_mode": threading_mode, "ssl_certfile": ssl_certfile, diff --git a/emmett/cli.py b/emmett/cli.py index 2e9590ca..dd1f2eba 100644 --- a/emmett/cli.py +++ b/emmett/cli.py @@ -291,6 +291,7 @@ def develop_command( port, loop=loop, log_level='debug', + log_access=True, threads=1, threading_mode="workers", ssl_certfile=ssl_certfile, @@ -326,9 +327,15 @@ def develop_command( @click.option( '--log-level', type=click.Choice(LOG_LEVELS.keys()), default='info', help='Logging level.') +@click.option( + '--access-log/--no-access-log', is_flag=True, default=False, + help='Enable access log.') @click.option( '--backlog', type=int, default=2048, help='Maximum number of connections to hold in backlog') +@click.option( + '--backpressure', type=int, + help='Maximum number of requests to process concurrently (per worker)') @click.option( '--ssl-certfile', type=str, default=None, help='SSL certificate file') @click.option( @@ -336,7 +343,7 @@ def develop_command( @pass_script_info def serve_command( info, host, port, workers, threads, threading_mode, interface, ws, loop, opt, - log_level, backlog, ssl_certfile, ssl_keyfile + log_level, access_log, backlog, backpressure, ssl_certfile, ssl_keyfile ): app_target = info._get_import_name() sgi_run( @@ -347,10 +354,12 @@ def serve_command( loop=loop, loop_opt=opt, log_level=log_level, + log_access=access_log, workers=workers, threads=threads, threading_mode=threading_mode, backlog=backlog, + backpressure=backpressure, enable_websockets=ws, ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile, diff --git a/emmett/server.py b/emmett/server.py index 468942fa..b59f4435 100644 --- a/emmett/server.py +++ b/emmett/server.py @@ -22,10 +22,12 @@ def run( loop='auto', loop_opt=False, log_level=None, + log_access=False, workers=1, threads=1, threading_mode='workers', backlog=1024, + backpressure=None, enable_websockets=True, ssl_certfile: Optional[str] = None, ssl_keyfile: Optional[str] = None @@ -38,13 +40,14 @@ def run( interface=interface, workers=workers, threads=threads, - pthreads=threads, threading_mode=threading_mode, loop=loop, loop_opt=loop_opt, websockets=enable_websockets, backlog=backlog, + backpressure=backpressure, log_level=log_level, + log_access=log_access, ssl_cert=ssl_certfile, ssl_key=ssl_keyfile )