Thank you for your interest in contributing to the Log File Generator project! This document provides information about the solution structure, development setup, testing, and how to submit contributions.
- .NET 8.0 SDK or later
- Git
- A code editor (Visual Studio, VS Code, or Rider recommended)
git clone https://github.com/Insight-NA/log-file-generator.git
cd log-file-generatorLoggerApplication/
├── src/
│ ├── Program.cs # Main application logic
│ └── LoggerApplication.csproj # Project file
├── tests/
│ └── LoggerApplication.Tests/
│ ├── LoggerApplicationTests.cs # Integration tests
│ └── LoggerApplication.Tests.csproj
├── .github/
│ └── workflows/
│ └── build-release.yml # CI/CD pipeline
├── LoggerApplication.sln # Solution file
├── params.txt # Example parameter file
├── README.md # User documentation
└── CONTRIBUTING.md # This file
The main application consists of several key components:
- Main Method: Reads and parses the parameter file, validates configurations, and starts multiple logger threads
- LoggerConfig Class: Holds configuration for each simulated application (log rate, file size, directory)
- RunLogger Method: Executes on separate threads with CancellationToken support for graceful shutdown
- RollingFileLogger Class: Manages file creation, rollover based on size, and writing log messages
- Multi-threading: Each configuration runs in its own thread using
Task.Run() - Thread Safety: Each logger instance writes to its own directory, eliminating the need for locking
- Graceful Shutdown:
Console.CancelKeyPressevent handler ensures clean termination - Random Timing: Log generation timing is randomized ±50% around the configured average
dotnet builddotnet build -c Releasedotnet publish -c Release -r win-x64 --self-containedOutput will be in src/bin/Release/net8.0/win-x64/publish/
dotnet testdotnet test tests/LoggerApplication.Tests/LoggerApplication.Tests.csprojThe test suite includes 6 integration tests:
- Application_CreatesLogDirectory - Verifies directory creation
- Application_CreatesLogFilesWithCorrectNaming - Validates filename format (yyyyMMdd-HHmm.log)
- Application_WritesLogMessagesWithCorrectFormat - Checks log entry format
- Application_CreatesMultipleLogFilesWhenSizeExceeded - Tests file rollover behavior
- Application_FailsWithInvalidArguments - Validates error handling for invalid input
- Application_GeneratesUniqueGuidsPerMessage - Ensures unique GUIDs per log entry
All tests use temporary parameter files and clean up after execution.
The project uses GitHub Actions for continuous integration and releases. The workflow (.github/workflows/build-release.yml) includes:
- Push to main: Runs build and tests
- Pull requests: Validates changes before merging
- Release creation: Builds and publishes artifacts
-
Build Job
- Restores dependencies
- Builds the solution
- Runs all unit tests
- Creates self-contained Windows x64 executable
- Uploads build artifacts
-
Release Job (on release creation only)
- Downloads build artifacts
- Creates ZIP package
- Uploads to GitHub Release
-
Create and push a tag:
git tag v1.0.0 git push origin v1.0.0
-
Create a GitHub Release from the tag
-
The workflow automatically builds and attaches
LoggerApplication.zip
- Fork the repository on GitHub
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Run tests to ensure nothing breaks:
dotnet test - Commit your changes with clear commit messages:
git commit -am "Add feature: description of what you added" - Push to your fork:
git push origin feature/your-feature-name
- Open a Pull Request on GitHub
- Follow standard C# naming conventions
- Keep methods focused and single-purpose
- Add XML documentation comments for public methods
- Ensure all tests pass before submitting PR
- Write tests for new features
- Code builds successfully
- All tests pass
- New features include tests
- README.md updated if user-facing changes
- CONTRIBUTING.md updated if developer-facing changes
- Clear description of changes in PR
We welcome suggestions and improvements! Here's how to propose changes:
- Check if the issue already exists
- Create a new issue with:
- Clear description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, .NET version)
- Open an issue describing:
- The problem you're trying to solve
- Your proposed solution
- Any alternative approaches considered
- Fork the repository
- Create a feature branch
- Implement your changes with tests
- Submit a pull request with:
- Clear description of the changes
- Link to related issue (if applicable)
- Screenshots/examples if relevant
If you have questions about contributing:
- Open an issue on GitHub
- Check existing issues and pull requests
- Review this document and README.md
- Be respectful and constructive
- Focus on the code, not the person
- Help others learn and improve
- Assume good intentions
Thank you for contributing to Log File Generator!