Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web.run_app support access_log_class param #2616

Merged
merged 7 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 5 additions & 3 deletions aiohttp/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from . import (web_exceptions, web_fileresponse, web_middlewares, web_protocol,
web_request, web_response, web_runner, web_server,
web_urldispatcher, web_ws)
web_urldispatcher, web_ws, helpers)
from .http import HttpVersion # noqa
from .log import access_logger
from .web_app import Application # noqa
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
5 changes: 5 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the following lines after the last :param: item

.. versionadded:: 3.0

   Support *access_log_class* parameter.

: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 Down