import logging
from functools import wraps

from console import conslog

_log = logging.getLogger(__name__)


def log_url(view):
    @wraps(view)
    def wrapper(request, *args, **kwargs):
        conslog.add_info_log(conslog.url_access_log(request), _log)
        return view(request, *args, **kwargs)

    return wrapper
