diff --git a/fastapi_auth/auth_config.py b/fastapi_auth/auth_config.py index 36df62b..1b07498 100644 --- a/fastapi_auth/auth_config.py +++ b/fastapi_auth/auth_config.py @@ -8,6 +8,7 @@ class AuthConfig(BaseSettings): secret_key: SecretStr = DEFAULT_KEY db_uri: str = DEFAULT_DB_URI + log_filename: str = "fastpi_auth.log" class Config: env_prefix = "AUTH_" diff --git a/fastapi_auth/auth_routes.py b/fastapi_auth/auth_routes.py index 8fa6b79..0a2554b 100644 --- a/fastapi_auth/auth_routes.py +++ b/fastapi_auth/auth_routes.py @@ -1,13 +1,13 @@ from typing import Optional -from fastapi import Depends, Form, Request, APIRouter +from fastapi import Depends, Request, APIRouter from fastapi.responses import HTMLResponse, RedirectResponse from starlette import status from .dependencies import get_user from .logger import LOG from .users import User, ANONYMOUS_USER -from .user_management_sqlobject import get_user_from_fastapi_request, authenticate_user_for_fastapi +from .user_management_sqlobject import authenticate_user_for_fastapi from .jinja2_templates import templates from starlette.middleware.sessions import SessionMiddleware diff --git a/fastapi_auth/logger.py b/fastapi_auth/logger.py index 20fdab4..44a19f8 100644 --- a/fastapi_auth/logger.py +++ b/fastapi_auth/logger.py @@ -1,3 +1,9 @@ from loguru import logger as LOG # noqa -LOG.add("fastapi-auth.log", level="DEBUG", retention="10 days") +from .auth_config import AUTH_SETTINGS + +LOG.add( + AUTH_SETTINGS.log_filename, + level="DEBUG", + retention="10 days", +)