diff options
author | Devaev Maxim <[email protected]> | 2018-12-16 02:28:13 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-12-16 02:28:13 +0300 |
commit | d7fb06d22ebfad8134c5d1a1e2bd6f6001baf8c4 (patch) | |
tree | 4ec7f3d4e10601767f9f97b9b8ecc49979f6c64c /kvmd/apps | |
parent | e5dfc9e30688752752c3ec20714c9b8c83efa4f7 (diff) |
better access log
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/kvmd/__init__.py | 1 | ||||
-rw-r--r-- | kvmd/apps/kvmd/server.py | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/__init__.py b/kvmd/apps/kvmd/__init__.py index 480a1017..e8b74abc 100644 --- a/kvmd/apps/kvmd/__init__.py +++ b/kvmd/apps/kvmd/__init__.py @@ -94,6 +94,7 @@ def main() -> None: msd=msd, streamer=streamer, + access_log_format=str(config["server"]["access_log_format"]), heartbeat=float(config["server"]["heartbeat"]), streamer_shutdown_delay=float(config["streamer"]["shutdown_delay"]), msd_chunk_size=int(config["msd"]["chunk_size"]), diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index 3981f59b..b204df7d 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -198,6 +198,7 @@ class Server: # pylint: disable=too-many-instance-attributes msd: MassStorageDevice, streamer: Streamer, + access_log_format: str, heartbeat: float, streamer_shutdown_delay: float, msd_chunk_size: int, @@ -214,6 +215,7 @@ class Server: # pylint: disable=too-many-instance-attributes self.__msd = msd self.__streamer = streamer + self.__access_log_format = access_log_format self.__heartbeat = heartbeat self.__streamer_shutdown_delay = streamer_shutdown_delay self.__msd_chunk_size = msd_chunk_size @@ -251,17 +253,23 @@ class Server: # pylint: disable=too-many-instance-attributes assert port or unix_path if unix_path: - kwargs: Dict = {} + socket_kwargs: Dict = {} if unix_rm and os.path.exists(unix_path): os.remove(unix_path) server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) server_socket.bind(unix_path) if unix_mode: os.chmod(unix_path, unix_mode) - kwargs = {"sock": server_socket} + socket_kwargs = {"sock": server_socket} else: - kwargs = {"host": host, "port": port} - aiohttp.web.run_app(app, print=self.__run_app_print, **kwargs) + socket_kwargs = {"host": host, "port": port} + + aiohttp.web.run_app( + app=app, + access_log_format=self.__access_log_format, + print=self.__run_app_print, + **socket_kwargs, + ) async def __make_info(self) -> Dict: return { |