Merged
Conversation
- Add LogLevel and Environment enums - Define ILogFormatter, ILogFilter, ILogHandler protocols - Export public API in __init__.py
- JSONFormatter for structured logging - ConsoleFormatter with color support - Both implement ILogFormatter interface
- SensitiveDataFilter for password/token redaction - LevelFilter for log level filtering - Both implement ILogFilter interface
- ConsoleHandler for stdout/stderr logging - FileHandler for file logging - DailyRotatingFileHandler with log rotation - All implement ILogHandler interface
- LoggerConfig with environment presets - Presets for development, testing, staging, production - Configurable formatters, handlers, and filters
- LogContext for request-scoped metadata - Context manager for automatic cleanup - Thread-safe using contextvars
- Main logger orchestration class - Integrates formatters, handlers, and filters - Filters reserved LogRecord attributes - Performance measurement with measure_time()
- get_logger() function with caching - clear_loggers() for cache management - Singleton pattern per logger name
- Add conftest.py to configure Python path - Enable clean imports in tests
- 12 tests covering all logger functionality - Test basic logging, context, filtering, performance - Test environment configs and multiple loggers
- Practical examples for logger usage - Demonstrate all major features
- Comprehensive logger documentation with examples - Generic testing guide for pytest setup - Best practices and troubleshooting
- Architecture documentation with design principles - Development guide with workflows and patterns - Code quality guidelines and best practices
- Remove old test_api.py - Remove generic services subdirectories - Preparing for new modular service architecture
- Add service structure with routers, models, functions - Follows new modular architecture pattern
- Update main.py for new service structure - Update Keycloak authorization module - Integrate logger system
- Database, Redis, Keycloak settings - CORS, logging, cache configuration - Rate limiting and feature flags - Auto-loads from .env, Docker secrets, K8s secrets - Validates SECRET_KEY in production
- Remove duplicate Environment enum from logger - Import Environment from app.shared.config.enums - Single source of truth for environment detection
- Add BaseResponse base class for all API responses - Include success, message, timestamp, request_id, metadata fields - Use Pydantic v2 ConfigDict - Auto-generate UTC timestamps with datetime.now(UTC) - Optional success field for flexibility
- Add SuccessResponse[T] with optional typed data - Add DataResponse[T] with required typed data - Add MessageResponse for simple message-only responses - Use TypeVar for type-safe generic responses - Pydantic v2 ConfigDict with examples
- Add ErrorResponse with HTTP status code mapping - Add ValidationErrorResponse for field-level validation errors - Implement from_exception() for AppException integration - Map error categories to HTTP status codes (404, 422, 401, etc.) - Optional debug logging in development mode - Status code validation (400-599)
…gation - Add PageInfo with page, size, total, pages fields - Add PaginatedResponse[T] for page-based pagination - Add CursorInfo for cursor-based pagination metadata - Add CursorPaginatedResponse[T] for infinite scrolling - Validation for page numbers and sizes - Generic type support with TypeVar - Optimized for webshop product listings
…tion - Add success(), data_response(), message_response() helpers - Add error(), error_from_exception(), validation_error() helpers - Add paginated() and cursor_paginated() helpers - Auto-calculate total pages in paginated() - Convenience aliases: ok, created, accepted, not_found, etc. - Optional config/logger integration for debug logging - Environment-aware logging (dev/debug mode only)
- Export all response models and factory functions - Export convenience aliases - Clean public interface - Comprehensive __all__ list
Tests cover: - Success/error/paginated responses - Exception integration and status mapping - Type safety with generics - Factory functions and pagination logic
Includes architecture, usage examples, FastAPI integration, best practices, and troubleshooting guide
maltonoloco
approved these changes
Dec 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core Change
Description
Introducing core utils as standalone moduls. Logging, Exceptions, Responses, config.
Scope
Motivation
New core functionallity, unifyed login, exception, responses and config. Set as standalone moduls as available shared inports. Consult the repos docs/ files for details.
Testing Strategy
Documentation
Checklist