Thank you for your interest in contributing to logcoe!
- CMake 3.14+
- C++17 compatible compiler
- Git
git clone https://github.com/nircoe/logcoe.git
cd logcoe
mkdir build && cd build
cmake -DLOGCOE_BUILD_TESTS=ON ..
cmake --build .logcoe uses testcoe for its test suite, providing enhanced test visualization:
# Run all tests
./tests/logcoe_tests
# Tests include:
# - Basic functionality tests
# - Thread safety verification
# - Cross-platform compatibility
# - Performance validationlogcoe/
├── include/
│ └── logcoe.hpp # Public API header
├── src/
│ └── logcoe.cpp # Implementation
├── tests/
│ ├── main.cpp # Test runner
│ ├── logcoe_test.cpp # Functional tests
│ └── logcoe_thread_test.cpp # Thread safety tests
├── docs/ # Documentation
└── .github/workflows/ # CI configuration
All pull requests are automatically tested on:
- Windows: MSVC 2019/2022 and MinGW
- Linux: GCC 7+ and Clang 5+
- macOS: Apple Clang (Xcode 10+)
The CI runs the following checks:
- Build the library with different compilers
- Run comprehensive test suite
- Verify thread safety under load
- Test cross-platform compatibility
- Check memory safety (when available)
- Follow existing naming conventions:
camelCasefor functions and variablesPascalCasefor classes and enumss_prefix for static members
- Keep lines under 120 characters
- Add comments for complex logic
- Use
constandconstexprwhere appropriate
namespace logcoe
{
void setLogLevel(LogLevel level)
{
std::lock_guard<std::mutex> lock(s_mutex);
s_logLevel = level;
}
}- Add tests for new features in appropriate test files
- Ensure thread safety tests pass for concurrent operations
- Test edge cases and error conditions
- Verify cross-platform behavior through CI
- Include performance considerations for new features
- Fork the repository
- Create a feature branch
- Make your changes following the code style
- Add/update tests as needed
- Run tests locally and ensure they pass
- Commit with clear, descriptive messages
- Push to your fork
- Open a Pull Request from your fork to the main repository
- Use prefix for PR title
[Subject]: <PR title> - PR description should describe the major changes in bullet-points
- Sqaushed commit title should be the PR title, and the message should be PR description
Example:
[Time Format]: Add custom time format validation
- Validate strftime format strings before applying
- Return error for invalid formats
- Add tests for format validation
When adding features:
-
Update Public API (if needed):
- Modify
include/logcoe.hpp - Maintain backward compatibility
- Add documentation comments
- Modify
-
Implement in LoggerImpl:
- Add to
src/logcoe.cpp - Ensure thread safety with proper locking
- Handle error cases gracefully
- Add to
-
Add Tests:
- Functional tests in
logcoe_test.cpp - Thread safety tests in
logcoe_thread_test.cpp - Test both success and failure cases
- Functional tests in
-
Update Documentation:
- Update README.md examples
- Add to API reference section
- Update architecture docs if needed
When modifying logcoe:
- Always Use Mutex: Every function that accesses static state must lock
s_mutex - Minimize Lock Duration: Perform I/O operations efficiently under lock
- Avoid Nested Locks: Current design uses single mutex to prevent deadlocks
- Test Concurrency: Add thread safety tests for new features
Feel free to reach out at nircoe@gmail.com
I'm here to help make contributing to logcoe as smooth as possible!