Skip to content

Commit

Permalink
web.run_app support access_log_class param (#2616)
Browse files Browse the repository at this point in the history
* Function web.run_app add param access_log_class

* Docs of web.run_app add param access_log_class

* Add changelog and contributor

* make isort

* Update docs/web_reference.rst
  • Loading branch information
codeif authored and asvetlov committed Dec 21, 2017
1 parent 97b9373 commit 19c138c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES/2615.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add param access_log_class to web.run_app function
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ Will McGugan
Willem de Groot
Wilson Ong
Wei Lin
Weiwei Wang
Yannick Koechlin
Yannick Péroux
Yegor Roganov
Expand Down
10 changes: 6 additions & 4 deletions aiohttp/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from collections import Iterable
from importlib import import_module

from . import (web_exceptions, web_fileresponse, web_middlewares, web_protocol,
web_request, web_response, web_runner, web_server,
from . import (helpers, web_exceptions, web_fileresponse, web_middlewares,
web_protocol, web_request, web_response, web_runner, web_server,
web_urldispatcher, web_ws)
from .http import HttpVersion # noqa
from .log import access_logger
Expand Down Expand Up @@ -38,12 +38,14 @@

def run_app(app, *, host=None, port=None, path=None, sock=None,
shutdown_timeout=60.0, ssl_context=None,
print=print, backlog=128, access_log_format=None,
access_log=access_logger, handle_signals=True):
print=print, backlog=128, access_log_class=helpers.AccessLogger,
access_log_format=None, access_log=access_logger,
handle_signals=True):
"""Run an app locally"""
loop = asyncio.get_event_loop()

runner = AppRunner(app, handle_signals=handle_signals,
access_log_class=access_log_class,
access_log_format=access_log_format,
access_log=access_log)

Expand Down
8 changes: 8 additions & 0 deletions docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,7 @@ Utilities
.. function:: run_app(app, *, host=None, port=None, path=None, \
sock=None, shutdown_timeout=60.0, \
ssl_context=None, print=print, backlog=128, \
access_log_class=aiohttp.helpers.AccessLogger, \
access_log_format=None, \
access_log=aiohttp.log.access_logger, \
handle_signals=True)
Expand Down Expand Up @@ -2330,6 +2331,10 @@ Utilities
system will allow before refusing new
connections (``128`` by default).

:param access_log_class: class for `access_logger`. Default:
:data:`aiohttp.helpers.AccessLogger`.
Must to be a subclass of :class:`aiohttp.abc.AbstractAccessLogger`.

:param access_log: :class:`logging.Logger` instance used for saving
access logs. Use ``None`` for disabling logs for
sake of speedup.
Expand All @@ -2341,6 +2346,9 @@ Utilities
:param bool handle_signals: override signal TERM handling to gracefully
exit the application.

.. versionadded:: 3.0

Support *access_log_class* parameter.

Constants
---------
Expand Down

0 comments on commit 19c138c

Please sign in to comment.