feat: Phase 1 Foundation - Modern C++20 Architecture#1
Merged
Conversation
- Added CMake options for thread_system integration (USE_THREAD_SYSTEM, LOGGER_STANDALONE) - Implemented conditional compilation to use thread_system interfaces when available - Updated all header files with conditional includes (#ifdef USE_THREAD_SYSTEM) - Successfully builds with thread_system as sibling directory - Maintains backward compatibility with standalone mode This completes the foundation work for Result pattern and advanced features.
…tion - Comprehensive error_codes.h with logger-specific error codes - All public APIs now return result_void or result<T> - All writer interfaces and implementations updated - Support for both thread_system and standalone modes - Logger library successfully builds with Result pattern Implementation highlights: - add_writer(), start(), stop() return result_void - get_current_metrics() returns result<performance_metrics> - All writer write() and flush() methods return result_void - Proper error propagation throughout the codebase - Error handling in file operations, network writes, encryption This completes F2 of Phase 1, establishing robust error handling throughout the logger system using the Result pattern from thread_system.
Implement interface segregation principle for better modularity: - Add separate interfaces for writers, filters, formatters, and sinks - Create unified log_entry structure for data passing - Update base classes to implement new interfaces - Add formatter implementations (plain, json, compact) - Maintain backward compatibility with existing APIs This change improves component independence and testability while preserving existing functionality. All tests passing successfully.
- Created logger_config.h with comprehensive validation logic - Validates buffer size, batch size, flush interval - Validates queue settings, file settings, network settings - Validates writer settings, thread count, feature combinations - Implemented logger_builder with fluent interface - Builder pattern for constructing logger instances - Automatic configuration validation before build - Support for predefined templates - Added predefined configuration templates - production: optimized for production environments - debug: immediate output for debugging - high_performance: maximized throughput - low_latency: minimized latency - Created comprehensive unit tests - 18 tests covering all validation scenarios - Tests for builder pattern functionality - Tests for invalid configurations - Updated error_codes.h with make_error helper functions
- Updated README.md with new features and usage examples - Added builder pattern examples - Documented configuration templates - Added error handling examples - Documented interface architecture - Created comprehensive API_REFERENCE.md - Complete API documentation for all classes - Detailed method signatures and parameters - Error codes and handling - Migration guide from v1.0 - Updated CHANGELOG.md with Phase 1 changes - Documented all F1-F4 improvements - Listed all new features and changes - Added technical details
- Added vcpkg binary caching (x-gha) for faster builds - Implemented proper cache key structure with vcpkg commit tracking - Added fallback mechanisms for resilient builds - Configured proper triplets per platform - Added test result artifact uploads - Improved cache invalidation logic - Added permissions for GitHub token - Created comprehensive workflow documentation Improvements applied to: - Ubuntu GCC workflow - Ubuntu Clang workflow - Windows Visual Studio workflow Expected performance improvements: - First run: ~30-40% faster - Subsequent runs: ~60-70% faster - No dependency changes: ~80-90% faster
…to MinGW/MSYS2 - Upgraded all workflows from deprecated upload-artifact@v3 to v4 - Applied comprehensive improvements to Windows MinGW workflow: * Added vcpkg binary caching with x-gha * Implemented proper cache key structure with vcpkg commit tracking * Added fallback mechanism to system libraries * Configured VCPKG_DEFAULT_TRIPLET for x64-mingw-dynamic - Applied same improvements to Windows MSYS2 workflow - Updated README_WORKFLOW_IMPROVEMENTS.md to reflect all completed tasks - All workflows now have consistent caching strategy and resilience
- Created vcpkg.json with required dependencies (fmt, spdlog, gtest, benchmark) - Fixed .gitignore to not exclude vcpkg.json (removed *.json pattern) - This fixes all CI/CD workflow failures due to missing vcpkg manifest
- Added missing container headers (unordered_map, vector, deque, queue) - Added missing concurrency headers (thread, atomic, mutex, condition_variable) - Added missing utility headers (regex, functional, memory, cstdint) - Added missing algorithm and character manipulation headers (cctype, algorithm) - Ensures explicit dependencies for all standard library features used - Improves portability across different compilers and platforms
- Added template version of make_logger_error for result<T> types - Fixed type conversion errors in logger.cpp by explicitly specifying template parameters - Fixed unused private field warning by using type_ field in encrypt_data method - Added encryption type check to support 'none' encryption mode
- Added Windows socket headers (winsock2.h, ws2tcpip.h) with conditional compilation - Added Winsock initialization/cleanup for Windows in network_writer and log_server - Fixed socket API differences between Windows and Unix (closesocket, SD_BOTH, etc.) - Added 'none' value to encryption_type enum for passthrough mode - Ensured cross-platform compatibility for network components
- Update metrics_demo.cpp to use .value() for successful result access - Update security_demo.cpp to use .value() for successful result access - Ensure proper error handling with result pattern throughout samples
- Fix API consistency issues
* Standardize result<T> and result_void usage patterns
* Add make_logger_error helper functions
* Support both USE_THREAD_SYSTEM and standalone modes
- Update sample applications
* Correct result<T>.value() access patterns
* Proper error handling in metrics and security demos
- Enhanced CompilerChecks.cmake with Windows-specific configuration
- Added automatic CI environment detection (ENV{CI}, ENV{GITHUB_ACTIONS})
- Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY for Windows
- Added proper MSVC flags: /std:c++20 /permissive- /Zc:__cplusplus /EHsc
- Added MinGW flags: -std=c++20 -pthread -lstdc++fs -lwinpthread
- Added check_cpp_stdlib_features() for thread_system compatibility
- Included C++17 feature checks (optional, variant, string_view)
- Fixed missing headers in writer implementations
- Added <ctime> to file_writer.cpp and rotating_file_writer.cpp
- Added <cerrno> to network_writer.cpp for error handling
- Updated all Windows workflows for better C++ feature detection
- build-windows-vs.yaml: Added MSVC-specific compile flags
- build-windows-mingw.yaml: Added MinGW threading and filesystem flags
- build-windows-msys2.yaml: Added MSYS2 compatibility flags
This resolves compilation errors during CMake feature detection phase
on Windows CI runners without requiring workflow file workarounds.\
Fixed platform-specific compilation issues in Windows CI: 1. structured_logger.h: - Added Windows-specific includes for Winsock2 and process.h - Fixed gethostname() availability on Windows (requires Winsock) - Added WSAStartup initialization for Windows in constructor - Used _getpid() instead of getpid() on Windows - Added fallback hostname handling for Windows 2. network_writer.cpp: - Fixed ssize_t type not defined on Windows - Added typedef for ssize_t using SSIZE_T on Windows - Used int type for send() return value on Windows (MSVC) - Added proper type casting for data.length() on Windows These changes resolve: - MSYS2: 'gethostname' was not declared in this scope - Visual Studio: 'ssize_t': undeclared identifier
- Added missing <chrono> header to log_server.h for std::chrono::system_clock types - Added ssize_t typedef in log_server.cpp for Windows compatibility (recv return type) - Added ws2_32 library linking for Windows builds to resolve Winsock undefined references These fixes address Visual Studio compilation errors and MSYS2 linking errors reported in the Windows CI builds.
This was referenced Dec 1, 2025
This was referenced Jan 31, 2026
8 tasks
Merged
4 tasks
4 tasks
This was referenced Mar 20, 2026
1 task
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
feat: Phase 1 Foundation - Modern C++20 Architecture
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.
Summary
This PR implements Phase 1 Foundation of the logger_system improvement plan, establishing a modern C++20 architecture with comprehensive error handling, clean interfaces, and robust configuration validation.
Key Improvements:
Changes
F1: Thread System Integration ✅
USE_THREAD_SYSTEM)F2: Result Pattern Implementation ✅
error_codes.hwith comprehensivelogger_error_codeenum (20+ error conditions)result_voidorresult<T>for proper error propagationF3: Interface Segregation (SOLID) ✅
log_writer_interface: Core writer contractlog_filter_interface: Filter abstractionlog_formatter_interface: Formatting contractlog_sink_interface: Output sink abstractionlog_entrystructure for data passingbase_formatterwith implementations (plain, json, compact)F4: Configuration Validation Framework ✅
logger_config.hwith comprehensive validation logicproduction: Metrics enabled, crash handlerdebug: Synchronous, immediate outputhigh_performance: 64KB buffer, lock-freelow_latency: 10ms flush, small batcheslogger_builder.hwith fluent interfaceTest Plan
Test Commands:
Performance Impact
Migration Guide
For Existing Users:
The old API continues to work without changes:
Recommended New Usage:
Documentation
Related Issues
Implements Phase 1 of the logger_system modernization plan.
Checklist