Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ba74efc
Add .gitleaks.toml for secrets scanning configuration
Chris-Wolfgang Mar 25, 2026
681a4e9
Add concurrency groups and gitleaks scanning to PR workflow
Chris-Wolfgang Mar 25, 2026
c734708
Add CycloneDX SBOM generation to release workflow
Chris-Wolfgang Mar 25, 2026
7ae7a8b
Add single-commit docfx deploy, version picker, and build-all-versions
Chris-Wolfgang Mar 25, 2026
ff3492f
Add setup and formatting scripts
Chris-Wolfgang Mar 25, 2026
90c8d1f
Upgrade feature request template from Markdown to GitHub Forms
Chris-Wolfgang Mar 25, 2026
9192c34
Add Setup-Labels.ps1 script
Chris-Wolfgang Mar 25, 2026
304090d
Add Fix-BranchRuleset.ps1, update Setup-BranchRuleset.ps1, secure pr.…
Chris-Wolfgang Mar 28, 2026
68a5b9b
Update Fix-BranchRuleset.ps1 to auto-run Setup-BranchRuleset.ps1 on s…
Chris-Wolfgang Mar 28, 2026
2dbdae9
Add -Confirm (-y) flag to Fix-BranchRuleset.ps1 to skip prompt
Chris-Wolfgang Mar 28, 2026
0ab34b9
Add build-pr.ps1 script to replicate PR checks locally
Chris-Wolfgang Mar 28, 2026
f27ea44
Auto-install gitleaks if not found
Chris-Wolfgang Mar 29, 2026
b09fb20
Match pr.yaml failure behavior: early exit and coverlet.runsettings
Chris-Wolfgang Mar 29, 2026
7e1ed53
Add SECURITY.md for responsible vulnerability disclosure
Chris-Wolfgang Mar 29, 2026
85db962
Add .claude/ to .gitignore
Chris-Wolfgang Apr 12, 2026
c77b354
Merge pull request #9 from Chris-Wolfgang/feature/fix-branch-ruleset-…
Chris-Wolfgang Apr 14, 2026
74a3180
Merge pull request #11 from Chris-Wolfgang/update/add-security-md
Chris-Wolfgang Apr 14, 2026
5bf3d02
Merge pull request #6 from Chris-Wolfgang/update-repo/upgrade-feature…
Chris-Wolfgang Apr 14, 2026
b487ed9
Merge pull request #7 from Chris-Wolfgang/update-repo/add-setup-labels
Chris-Wolfgang Apr 14, 2026
15a3533
Merge pull request #13 from Chris-Wolfgang/chore/gitignore-claude
Chris-Wolfgang Apr 14, 2026
604050d
Resolve merge conflict: keep develop version of Setup-BranchRuleset.ps1
Chris-Wolfgang Apr 14, 2026
31c2f70
Add repo-template config files
Chris-Wolfgang Apr 14, 2026
0110633
Add docfx toc.yml and logo.svg from repo-template
Chris-Wolfgang Apr 14, 2026
c495e77
Add CodeQL security analysis workflow
Chris-Wolfgang Apr 14, 2026
23813f6
Merge remote-tracking branch 'origin/update-repo/add-gitleaks-toml' i…
Chris-Wolfgang Apr 14, 2026
21b3b7f
Merge remote-tracking branch 'origin/update-repo/add-gitleaks-pr-scan…
Chris-Wolfgang Apr 14, 2026
27a3ca4
Merge remote-tracking branch 'origin/update-repo/add-sbom-generation'…
Chris-Wolfgang Apr 14, 2026
f867400
Merge remote-tracking branch 'origin/update-repo/single-commit-docfx'…
Chris-Wolfgang Apr 14, 2026
f9a2de6
Merge remote-tracking branch 'origin/update/add-template-config-files…
Chris-Wolfgang Apr 14, 2026
e1bd7b0
Merge remote-tracking branch 'origin/feature/add-build-pr-script' int…
Chris-Wolfgang Apr 14, 2026
bf61231
Merge remote-tracking branch 'origin/update/add-codeql-workflow' into…
Chris-Wolfgang Apr 14, 2026
4d35b3f
Code review fixes for InMemoryLogger
Chris-Wolfgang Apr 15, 2026
d0c50b3
Address Copilot review comments
Chris-Wolfgang Apr 15, 2026
5ac2283
Code review fixes for InMemoryLogger
Chris-Wolfgang Apr 15, 2026
cd39537
Address Copilot review comments
Chris-Wolfgang Apr 15, 2026
2d93032
Add non-generic logger, provider, DI extension, and scope tracking
Chris-Wolfgang Apr 15, 2026
faddaea
Merge remote-tracking branch 'origin/develop' into feature/add-logger…
Chris-Wolfgang Apr 15, 2026
d19a6bd
Address Copilot review: null check, scope safety, docs, reference ass…
Chris-Wolfgang Apr 15, 2026
bcbaf89
Merge pull request #17 from Chris-Wolfgang/feature/add-logger-infrast…
Chris-Wolfgang Apr 15, 2026
be71d81
Merge main into develop to pull in template-sync updates
Chris-Wolfgang Apr 26, 2026
e45ba09
Merge pull request #28 from Chris-Wolfgang/chore/merge-main-into-develop
Chris-Wolfgang Apr 26, 2026
32fc8d0
Fix Release-build analyzer errors
Chris-Wolfgang Apr 27, 2026
81c6de9
Merge pull request #30 from Chris-Wolfgang/fix/release-build-analyzer…
Chris-Wolfgang Apr 27, 2026
0db1e67
Merge main into develop to pull in PR #29
Chris-Wolfgang Apr 27, 2026
c880c63
Merge pull request #31 from Chris-Wolfgang/chore/merge-main-into-deve…
Chris-Wolfgang Apr 27, 2026
0a001dd
Fix CI Release-build analyzer errors
Chris-Wolfgang Apr 27, 2026
4d2ea58
Merge pull request #33 from Chris-Wolfgang/fix/release-build-ci-analy…
Chris-Wolfgang Apr 27, 2026
cbf035d
Upgrade release workflow actions to Node 24 and add .NET Core 3.1
Chris-Wolfgang Apr 27, 2026
2c38437
Merge pull request #34 from Chris-Wolfgang/chore/upgrade-actions-and-…
Chris-Wolfgang Apr 27, 2026
396dd03
Merge branch 'main' into develop
Chris-Wolfgang Apr 29, 2026
d01ba6e
Merge branch 'main' into develop
Chris-Wolfgang Apr 30, 2026
42bcb99
Merge branch 'main' into develop
Chris-Wolfgang Apr 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*.userosscache
*.sln.docstates
*.env
n# Claude Code
.claude/

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
19 changes: 15 additions & 4 deletions Solution.slnx → In-Memory Logger.slnx
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
<Solution>
<Folder Name="/.root/">
<File Path=".editorconfig" />
<File Path=".gitattributes" />
<File Path=".gitignore" />
<File Path=".globalconfig" />
<File Path="BannedSymbols.txt" />
<File Path="CODE_OF_CONDUCT.md" />
<File Path="CONTRIBUTING.md" />
<File Path="Directory.Build.props" />
<File Path="LICENSE" />
<File Path="README.md" />
<File Path="SETUP.md" />
<File Path="SECURITY.md" />
</Folder>
<Folder Name="/.root/.github/">
<File Path=".github/CODEOWNERS" />
<File Path=".github/copilot-instructions.md" />
<File Path=".github/dependabot.yml" />
<File Path=".github/pull_request_template.md" />
<File Path=".github/version-picker-template.html" />
</Folder>
<Folder Name="/.root/.github/ISSUE_TEMPLATE/">
<File Path=".github/ISSUE_TEMPLATE/BUG_REPORT.yaml" />
<File Path=".github/ISSUE_TEMPLATE/feature_request.md" />
<File Path=".github/ISSUE_TEMPLATE/feature_request.yaml" />
</Folder>
<Folder Name="/.root/.github/workflows/">
<File Path=".github/workflows/build-all-versions.yaml" />
<File Path=".github/workflows/codeql.yaml" />
<File Path=".github/workflows/create-labels.yaml" />
<File Path=".github/workflows/docfx.yaml" />
<File Path=".github/workflows/pr.yaml" />
<File Path=".github/workflows/release.yaml" />
</Folder>
<Folder Name="/benchmarks/" />
<Folder Name="/examples/" />
<Folder Name="/src/" />
<Folder Name="/tests/" />
<Folder Name="/src/">
<Project Path="src/Wolfgang.Extensions.Logging.InMemoryLogger/Wolfgang.Extensions.Logging.InMemoryLogger.csproj" Id="44f43cd5-6d56-4f06-86ab-f0a0779e785c" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Wolfgang.Extensions.Logging.InMemoryLogger.Tests.Unit/Wolfgang.Extensions.Logging.InMemoryLogger.Tests.Unit.csproj" Id="2b259f57-3bfb-4349-a94a-7a4646e8f0c7" />
</Folder>
</Solution>
190 changes: 26 additions & 164 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,181 +1,43 @@
# Wolfgang.Extensions.Logging.InMemoryLogger

Implementations of ILogger and ILogger<T> that write log events to an in-memory list. Useful for testing
An implementation of `ILogger<T>` from `Microsoft.Extensions.Logging` that writes log entries to an in-memory collection. Designed for use in unit and integration tests where you need to assert against logged messages.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![.NET](https://img.shields.io/badge/.NET-Multi--Targeted-purple.svg)](https://dotnet.microsoft.com/)
[![GitHub](https://img.shields.io/badge/GitHub-Repository-181717?logo=github)](https://github.com/Chris-Wolfgang/In-memory-Logger)
## Features

---
- Thread-safe in-memory log entry storage
- Configurable minimum log level
- Configurable initial capacity
- Supports all .NET log levels (Trace through Critical)
- Returns log entries as `IReadOnlyList<LogEntry<object>>` for easy assertion

## 📦 Installation
## Installation

```bash
```shell
dotnet add package Wolfgang.Extensions.Logging.InMemoryLogger
```

**NuGet Package:** Coming soon to NuGet.org
## Usage

---
```csharp
var logger = new InMemoryLogger<MyService>(LogLevel.Information);

## 📄 License
// Use the logger in your code under test
var service = new MyService(logger);
service.DoWork();

This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.

---

## 📚 Documentation

- **GitHub Repository:** [https://github.com/Chris-Wolfgang/In-memory-Logger](https://github.com/Chris-Wolfgang/In-memory-Logger)
- **API Documentation:** https://Chris-Wolfgang.github.io/In-memory-Logger/
- **Formatting Guide:** [README-FORMATTING.md](README-FORMATTING.md)
- **Contributing Guide:** [CONTRIBUTING.md](CONTRIBUTING.md)

---

## 🚀 Quick Start

{{QUICK_START_EXAMPLE}}

---

## ✨ Features

{{FEATURES_TABLE}}

**Examples:**
{{FEATURE_EXAMPLES}}

---

## 🎯 Target Frameworks

| Framework | Versions |
|-----------|----------|
| .NET Framework | .NET 4.6.2, .NET 4.7.0, .NET 4.7.1, .NET 4.7.2, .NET 4.8, .NET 4.8.1 |
| .NET Core | .NET Core 3.1 |
| .NET | .NET 5.0, .NET 6.0, .NET 7.0, .NET 8.0, .NET 9.0, .NET 10.0 |

---

## 🔍 Code Quality & Static Analysis

This project enforces **strict code quality standards** through **7 specialized analyzers** and custom async-first rules:

### Analyzers in Use

1. **Microsoft.CodeAnalysis.NetAnalyzers** - Built-in .NET analyzers for correctness and performance
2. **Roslynator.Analyzers** - Advanced refactoring and code quality rules
3. **AsyncFixer** - Async/await best practices and anti-pattern detection
4. **Microsoft.VisualStudio.Threading.Analyzers** - Thread safety and async patterns
5. **Microsoft.CodeAnalysis.BannedApiAnalyzers** - Prevents usage of banned synchronous APIs
6. **Meziantou.Analyzer** - Comprehensive code quality rules
7. **SonarAnalyzer.CSharp** - Industry-standard code analysis

### Async-First Enforcement

This library uses **`BannedSymbols.txt`** to prohibit synchronous APIs and enforce async-first patterns:

**Blocked APIs Include:**
- ❌ `Task.Wait()`, `Task.Result` - Use `await` instead
- ❌ `Thread.Sleep()` - Use `await Task.Delay()` instead
- ❌ Synchronous file I/O (`File.ReadAllText`) - Use async versions
- ❌ Synchronous stream operations - Use `ReadAsync()`, `WriteAsync()`
- ❌ `Parallel.For/ForEach` - Use `Task.WhenAll()` or `Parallel.ForEachAsync()`
- ❌ Obsolete APIs (`WebClient`, `BinaryFormatter`)

**Why?** To ensure all code is **truly async** and **non-blocking** for optimal performance in async contexts.

---

## 🛠️ Building from Source

### Prerequisites
- [.NET 8.0 SDK](https://dotnet.microsoft.com/download) or later
- Optional: [PowerShell Core](https://github.com/PowerShell/PowerShell) for formatting scripts

### Build Steps

```bash
# Clone the repository
git clone https://github.com/Chris-Wolfgang/In-memory-Logger.git
cd In-memory-Logger

# Restore dependencies
dotnet restore

# Build the solution
dotnet build --configuration Release

# Run tests
dotnet test --configuration Release

# Run code formatting (PowerShell Core)
pwsh ./format.ps1
```

### Code Formatting

This project uses `.editorconfig` and `dotnet format`:

```bash
# Format code
dotnet format

# Verify formatting (as CI does)
dotnet format --verify-no-changes
```

See [README-FORMATTING.md](README-FORMATTING.md) for detailed formatting guidelines.

### Building Documentation

This project uses [DocFX](https://dotnet.github.io/docfx/) to generate API documentation:

```bash
# Install DocFX (one-time setup)
dotnet tool install -g docfx

# Generate API metadata and build documentation
cd docfx_project
docfx metadata # Extract API metadata from source code
docfx build # Build HTML documentation

# Documentation is generated in the docs/ folder at the repository root
// Assert against captured log entries
Assert.Single(logger.LogEntries);
Assert.Equal(LogLevel.Information, logger.LogEntries[0].LogLevel);
```

The documentation is automatically built and deployed to GitHub Pages when changes are pushed to the `main` branch.

**Local Preview:**
```bash
# Serve documentation locally (with live reload)
cd docfx_project
docfx build --serve

# Open http://localhost:8080 in your browser
```

**Documentation Structure:**
- `docfx_project/` - DocFX configuration and source files
- `docs/` - Generated HTML documentation (published to GitHub Pages)
- `docfx_project/index.md` - Main landing page content
- `docfx_project/docs/` - Additional documentation articles
- `docfx_project/api/` - Auto-generated API reference YAML files

---

## 🤝 Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
- Code quality standards
- Build and test instructions
- Pull request guidelines
- Analyzer configuration details

---

## Target Frameworks

## 🙏 Acknowledgments
- .NET Framework 4.6.2
- .NET Standard 2.0
- .NET Standard 2.1
- .NET 8.0
- .NET 10.0

{{ACKNOWLEDGMENTS}}
## License

[MIT](LICENSE)
Loading
Loading