Aiohttp web server logging

Hi
i have a webserver and i want to be able to log the request, the response and time taken.

I came across this https://docs.aiohttp.org/en/stable/logging.html but when i try to use the drop in replacement for logging AccessLogger class. It fails with the following error:

Traceback (most recent call last):
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_log.py”, line 233, in log
self.logger.info(self._log_format % tuple(values), extra=extra)
AttributeError: type object ‘AccessLogger’ has no attribute ‘info’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 472, in start
self.log_access(request, resp, loop.time() - now)
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 348, in log_access
self.access_logger.log(request, response, time)
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_log.py”, line 235, in log
self.logger.exception(“Error in logging”)
AttributeError: type object ‘AccessLogger’ has no attribute ‘exception’
ERROR:aiohttp.server:Unhandled exception
Traceback (most recent call last):
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_log.py”, line 233, in log
self.logger.info(self._log_format % tuple(values), extra=extra)
AttributeError: type object ‘AccessLogger’ has no attribute ‘info’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 472, in start
self.log_access(request, resp, loop.time() - now)
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 348, in log_access
self.access_logger.log(request, response, time)
File “/home/kay/.local/share/virtualenvs/entity-extractor-BuK_iA9e/lib/python3.8/site-packages/aiohttp/web_log.py”, line 235, in log
self.logger.exception(“Error in logging”)

logger.py

from aiohttp.abc import AbstractAccessLogger
class AccessLogger(AbstractAccessLogger):

    def log(self, request, response, time):
        self.logger.info(f'{request.remote} '
                         f'"{request.method} {request.path} '
                         f'done in {time}s: {response.status}')

server.py

from aiohttp import web
from src.api import API
from src.logger import AccessLogger

server = API()
web.run_app(server.app,access_log=AccessLogger)

My end goal is to also have logs in a dictionary json format. If there is someway i can achieve this please let me know.