|
| 1 | +# GitHub Copilot Instructions for LogExpert |
| 2 | + |
| 3 | +## Repository Overview |
| 4 | + |
| 5 | +**LogExpert** is a Windows-based log file tail and analysis application written in C#. It's a GUI replacement for the Unix tail command, originally from CodePlex, with extensive features for viewing, analyzing, and filtering log files. |
| 6 | + |
| 7 | +### Key Features |
| 8 | +- Tail mode for real-time log monitoring |
| 9 | +- MDI-Interface with tabs for multiple files |
| 10 | +- Search functionality including RegEx support |
| 11 | +- Bookmarks and highlighting capabilities |
| 12 | +- Flexible filter views with filter-to-tab functionality |
| 13 | +- Columnizer plugins for parsing structured logs |
| 14 | +- Unicode support and log4j XML file support |
| 15 | +- 3rd party plugin architecture |
| 16 | +- Automatic columnizer detection (experimental) |
| 17 | +- Serilog.Formatting.Compact format support |
| 18 | + |
| 19 | +### Technology Stack |
| 20 | +- **Primary Language**: C# (.NET 10.0-windows target framework) |
| 21 | +- **UI Framework**: Windows Forms |
| 22 | +- **Build System**: Nuke Build System with MSBuild |
| 23 | +- **Target Platform**: Windows (requires Windows-specific dependencies) |
| 24 | +- **Package Management**: NuGet with central package management |
| 25 | +- **Testing**: NUnit framework |
| 26 | +- **CI/CD**: GitHub Actions + AppVeyor |
| 27 | + |
| 28 | +## High-Level Repository Information |
| 29 | + |
| 30 | +- **Repository Size**: Medium (~26 source projects) |
| 31 | +- **Project Type**: Desktop Application (Windows Forms) |
| 32 | +- **Architecture**: Plugin-based architecture with columnizers |
| 33 | +- **Main Entry Point**: `src/LogExpert/Program.cs` |
| 34 | +- **Main Solution**: `src/LogExpert.sln` |
| 35 | + |
| 36 | +## Build Instructions |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | +**CRITICAL**: This project requires Windows development environment and .NET 10.0.100 SDK or compatible. |
| 40 | + |
| 41 | +### Environment Setup |
| 42 | +1. **Install .NET SDK**: Project requires .NET 10.0.100 SDK (specified in `global.json`) |
| 43 | +2. **Windows Environment**: Build targets `net10.0-windows` and uses Windows Forms |
| 44 | +3. **Visual Studio**: Recommended Visual Studio 2026+ or Visual Studio Code with C# extension |
| 45 | +4. **Optional Dependencies**: |
| 46 | + - Chocolatey (for packaging) |
| 47 | + - Inno Setup 5 or 6 (for setup creation) |
| 48 | + |
| 49 | +### Build Commands |
| 50 | + |
| 51 | +#### Using Nuke Build System (Recommended) |
| 52 | +```bash |
| 53 | +# Windows Command Prompt/PowerShell |
| 54 | +./build.ps1 |
| 55 | + |
| 56 | +# Cross-platform (Linux/macOS) - Note: Limited functionality |
| 57 | +./build.sh |
| 58 | +``` |
| 59 | + |
| 60 | +#### Common Nuke Build Targets |
| 61 | +```bash |
| 62 | +# Clean and build |
| 63 | +./build.ps1 --target Clean Compile |
| 64 | + |
| 65 | +# Run tests |
| 66 | +./build.ps1 --target Test |
| 67 | + |
| 68 | +# Create packages |
| 69 | +./build.ps1 --target Pack |
| 70 | + |
| 71 | +# Full release build with setup |
| 72 | +./build.ps1 --target Clean Pack CreateSetup --configuration Release |
| 73 | +``` |
| 74 | + |
| 75 | +#### Direct .NET Commands |
| 76 | +```bash |
| 77 | +# From src/ directory |
| 78 | +dotnet restore |
| 79 | +dotnet build --no-restore |
| 80 | +dotnet test --no-build --verbosity normal |
| 81 | +``` |
| 82 | + |
| 83 | +### Known Build Issues and Workarounds |
| 84 | + |
| 85 | +1. **Cross-Platform Limitations**: |
| 86 | + - Linux/macOS builds will fail due to missing Windows Desktop SDK components |
| 87 | + - Error: "Microsoft.NET.Sdk.WindowsDesktop/targets" not found |
| 88 | + - **Workaround**: Use Windows environment or Windows Subsystem for Linux with proper .NET Windows SDK |
| 89 | + |
| 90 | +2. **.NET Version Mismatch**: |
| 91 | + - Project requires .NET 10.0.100 but may encounter .NET 8.0 environments |
| 92 | + - **Workaround**: Nuke build system automatically downloads correct SDK version |
| 93 | + |
| 94 | +3. **Build Timing**: |
| 95 | + - Full build: ~2-5 minutes on modern hardware |
| 96 | + - Test execution: ~30 seconds to 2 minutes |
| 97 | + - Package creation: Additional 1-3 minutes |
| 98 | + |
| 99 | +### Validation Steps |
| 100 | +Always run these validation steps after making changes: |
| 101 | +1. `./build.ps1 --target Clean Compile` (ensures clean build) |
| 102 | +2. `./build.ps1 --target Test` (runs all unit tests) |
| 103 | +3. Review build output in `bin/` directory |
| 104 | +4. Check for warnings in build output |
| 105 | + |
| 106 | +## Project Layout and Architecture |
| 107 | + |
| 108 | +### Repository Structure |
| 109 | +``` |
| 110 | +LogExpert/ |
| 111 | +├── .github/ # GitHub Actions workflows |
| 112 | +│ └── workflows/ # build_dotnet.yml, test_dotnet.yml |
| 113 | +├── src/ # Main source directory |
| 114 | +│ ├── LogExpert.sln # Main solution file |
| 115 | +│ ├── LogExpert/ # Main application project |
| 116 | +│ ├── LogExpert.Core/ # Core functionality library |
| 117 | +│ ├── LogExpert.UI/ # UI components library |
| 118 | +│ ├── LogExpert.Resources/ # Resource files |
| 119 | +│ ├── ColumnizerLib/ # Plugin interface library |
| 120 | +│ ├── Columnizers/ # Built-in columnizer plugins |
| 121 | +│ │ ├── CsvColumnizer/ |
| 122 | +│ │ ├── JsonColumnizer/ |
| 123 | +│ │ ├── RegexColumnizer/ |
| 124 | +│ │ └── ... # Other columnizers |
| 125 | +│ ├── Tests/ # Test projects |
| 126 | +│ │ ├── LogExpert.Tests/ |
| 127 | +│ │ ├── ColumnizerLib.UnitTests/ |
| 128 | +│ │ └── RegexColumnizer.UnitTests/ |
| 129 | +│ └── Solution Items/ # Shared configuration files |
| 130 | +├── build/ # Nuke build system |
| 131 | +│ ├── Build.cs # Main build script |
| 132 | +│ └── _build.csproj # Build project file |
| 133 | +├── chocolatey/ # Chocolatey package configuration |
| 134 | +├── lib/ # External libraries |
| 135 | +├── global.json # .NET SDK version pinning |
| 136 | +├── GitVersion.yml # Version configuration |
| 137 | +├── Directory.Build.props # MSBuild properties |
| 138 | +└── Directory.Packages.props # NuGet package versions |
| 139 | +``` |
| 140 | + |
| 141 | +### Key Configuration Files |
| 142 | +- **`global.json`**: Specifies required .NET SDK version (9.0.301) |
| 143 | +- **`src/Directory.Build.props`**: Common MSBuild properties for all projects |
| 144 | +- **`src/Directory.Packages.props`**: Centralized NuGet package version management |
| 145 | +- **`.editorconfig`**: Code style and formatting rules (comprehensive 4000+ line config) |
| 146 | +- **`GitVersion.yml`**: Semantic versioning configuration |
| 147 | +- **`appveyor.yml`**: AppVeyor CI configuration |
| 148 | + |
| 149 | +### Architectural Components |
| 150 | + |
| 151 | +#### Main Application (`src/LogExpert/`) |
| 152 | +- **`Program.cs`**: Application entry point with IPC for single-instance mode |
| 153 | +- **Target Framework**: `net8.0-windows` |
| 154 | +- **Dependencies**: LogExpert.UI, LogExpert.Core, ColumnizerLib, PluginRegistry |
| 155 | + |
| 156 | +#### Core Libraries |
| 157 | +- **`LogExpert.Core`**: Core business logic and interfaces |
| 158 | +- **`LogExpert.UI`**: Windows Forms UI components |
| 159 | +- **`LogExpert.Resources`**: Localization and resource files |
| 160 | +- **`ColumnizerLib`**: Plugin interface definitions |
| 161 | + |
| 162 | +#### Plugin System |
| 163 | +- **Columnizers**: Parse log lines into columns (CSV, JSON, RegEx, etc.) |
| 164 | +- **File System Plugins**: Support for different file sources (local, SFTP) |
| 165 | +- **Plugin Discovery**: Automatic plugin loading from application directory |
| 166 | + |
| 167 | +### CI/CD Pipeline |
| 168 | + |
| 169 | +#### GitHub Actions |
| 170 | +1. **`.github/workflows/build_dotnet.yml`**: |
| 171 | + - Triggers on PR to Development branch |
| 172 | + - Builds Debug and Release configurations |
| 173 | + - Uploads build artifacts |
| 174 | + - Uses windows-latest runner |
| 175 | + |
| 176 | +2. **`.github/workflows/test_dotnet.yml`**: |
| 177 | + - Runs on push to Development branch |
| 178 | + - Executes unit tests |
| 179 | + - Uses .NET 10.0.x SDK |
| 180 | + |
| 181 | +#### AppVeyor Integration |
| 182 | +- **`appveyor.yml`**: Legacy CI configuration |
| 183 | +- Builds packages and publishes artifacts |
| 184 | +- Creates setup executables with Inno Setup |
| 185 | + |
| 186 | +### Testing Strategy |
| 187 | +- **Unit Tests**: Located in `*Tests.csproj` projects |
| 188 | +- **Test Frameworks**: NUnit with Moq for mocking |
| 189 | +- **Test Data**: Located in `TestData/` directories within test projects |
| 190 | +- **Coverage**: Focus on core functionality and columnizer plugins |
| 191 | + |
| 192 | +### Dependencies and Libraries |
| 193 | +Key external dependencies (managed via Directory.Packages.props): |
| 194 | +- **NLog**: Logging framework |
| 195 | +- **Newtonsoft.Json**: JSON processing |
| 196 | +- **CsvHelper**: CSV file processing |
| 197 | +- **SSH.NET**: SFTP file system support |
| 198 | +- **DockPanelSuite**: UI docking panels |
| 199 | +- **NUnit/Moq**: Testing frameworks |
| 200 | + |
| 201 | +## Agent Guidance |
| 202 | + |
| 203 | +### Making Code Changes |
| 204 | +1. **Always build before changing**: Run `./build.ps1 --target Clean Compile Test` to establish baseline |
| 205 | +2. **Follow existing patterns**: Study similar implementations in the codebase |
| 206 | +3. **Respect architecture**: Use plugin interfaces for extensibility |
| 207 | +4. **Code style**: Follow `.editorconfig` rules (extensive configuration provided) |
| 208 | +5. **Null safety**: Project uses nullable reference types (`<Nullable>enable</Nullable>`) |
| 209 | + |
| 210 | +### Common Development Tasks |
| 211 | + |
| 212 | +#### Adding New Columnizer |
| 213 | +1. Create new project in `src/` directory following naming pattern `*Columnizer` |
| 214 | +2. Implement `ILogLineColumnizer` interface from `ColumnizerLib` |
| 215 | +3. Add project reference to main solution |
| 216 | +4. Add unit tests in corresponding `*Tests` project |
| 217 | + |
| 218 | +#### Modifying UI Components |
| 219 | +1. UI components are in `LogExpert.UI` project |
| 220 | +2. Follow Windows Forms patterns |
| 221 | +3. Be aware of High DPI considerations (documented in README) |
| 222 | +4. Test on different Windows versions if possible |
| 223 | + |
| 224 | +#### Adding Dependencies |
| 225 | +1. Update `src/Directory.Packages.props` for version management |
| 226 | +2. Add `<PackageReference>` in specific project files |
| 227 | +3. Ensure compatibility with .NET 10.0 target framework |
| 228 | + |
| 229 | +### Build Troubleshooting |
| 230 | +- **Missing Windows SDK**: Ensure Windows development environment |
| 231 | +- **Version conflicts**: Check `global.json` and upgrade SDK if needed |
| 232 | +- **Plugin loading issues**: Verify plugins are copied to output directory |
| 233 | +- **Test failures**: Check test data file paths and Windows-specific assumptions |
| 234 | + |
| 235 | +### Important Notes |
| 236 | +- **Windows-only**: This is a Windows-specific application using Windows Forms |
| 237 | +- **Plugin architecture**: Extensibility through columnizer and file system plugins |
| 238 | +- **Single instance**: Application uses named pipes for IPC between instances |
| 239 | +- **Legacy codebase**: Contains patterns from .NET Framework era, being modernized |
| 240 | +- **Comprehensive configuration**: Very detailed .editorconfig and analysis rules |
| 241 | + |
| 242 | +### Trust These Instructions |
| 243 | +These instructions are comprehensive and tested. Only search for additional information if: |
| 244 | +1. Instructions appear incomplete for your specific task |
| 245 | +2. You encounter errors not covered in the troubleshooting section |
| 246 | +3. You need to understand implementation details not covered here |
| 247 | + |
| 248 | +The build system, project structure, and development patterns described here are accurate as of the current codebase state. |
0 commit comments