From 704436713154afe0031ff93853072fb6ccd0345d Mon Sep 17 00:00:00 2001 From: Andreas Jung Date: Sun, 2 Jun 2024 19:15:48 +0200 Subject: [PATCH] updated --- fastapi_auth/auth_config.py | 1 + fastapi_auth/auth_routes.py | 4 ++-- fastapi_auth/logger.py | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) 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", +)