CerbiStream.GovernanceAnalyzer
1.0.1
See the version list below for details.
dotnet add package CerbiStream.GovernanceAnalyzer --version 1.0.1
NuGet\Install-Package CerbiStream.GovernanceAnalyzer -Version 1.0.1
<PackageReference Include="CerbiStream.GovernanceAnalyzer" Version="1.0.1" />
<PackageVersion Include="CerbiStream.GovernanceAnalyzer" Version="1.0.1" />
<PackageReference Include="CerbiStream.GovernanceAnalyzer" />
paket add CerbiStream.GovernanceAnalyzer --version 1.0.1
#r "nuget: CerbiStream.GovernanceAnalyzer, 1.0.1"
#addin nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.0.1
#tool nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.0.1
CerbiStream Governance Analyzer
CerbiStream-GovernanceAnalyzer is a Roslyn-based static analysis tool designed to enforce structured logging standards within applications using CerbiStream. It ensures that log messages adhere to governance rules defined in JSON configurations, reducing runtime validation overhead and improving developer experience.
🔥 Why Use CerbiStream-GovernanceAnalyzer?
- Compile-Time Log Validation – Prevents misformatted logs before deployment.
- Structured Logging Enforcement – Ensures consistent log structures across teams.
- Customizable Rules via JSON – Allows organizations to define mandatory fields for logs.
- Seamless Integration with CerbiStream – Works alongside CerbiStream for log governance.
- Lightweight & Fast – Runs at build time, avoiding runtime performance impact.
🚀 Installation
To add CerbiStream-GovernanceAnalyzer to your project, install it via NuGet:
dotnet add package CerbiStream.GovernanceAnalyzer
Or update your .csproj
:
<ItemGroup>
<PackageReference Include="CerbiStream.GovernanceAnalyzer" Version="1.0.0" />
</ItemGroup>
📌 How It Works
Governance Rules via JSON
- Define required and optional logging fields in a
cerbi_governance.json
file. - Example:
{ "LoggingProfiles": { "Default": { "RequiredFields": ["Timestamp", "LogLevel", "Message", "ApplicationId"], "OptionalFields": ["UserId", "TransactionId"] } } }
- Define required and optional logging fields in a
Static Analysis at Build-Time
- The analyzer verifies that logs match the governance profile during compilation.
- Example of a valid log:
logger.LogInformation("User login successful | UserId: {UserId}, Timestamp: {Timestamp}", userId, DateTime.UtcNow);
- Example of an invalid log (missing required fields):
logger.LogInformation("User login successful"); // ❌ Missing required metadata
- The build will fail with a warning/error indicating missing required fields.
Enforce or Warn Mode
- Choose whether governance rules should fail the build (
Error Mode
) or just warn developers (Warning Mode
). - This can be controlled via the
cerbi_governance.json
file.
- Choose whether governance rules should fail the build (
🛠️ Configuration Options
Option | Type | Description |
---|---|---|
RequiredFields |
string[] |
Fields that must be present in logs. |
OptionalFields |
string[] |
Fields that are recommended but not mandatory. |
EnforcementLevel |
string |
Can be Error (fail build) or Warning (notify devs). |
📖 Example Usage
1️⃣ Enabling Governance in CerbiStream
In your Program.cs
:
var serviceProvider = new ServiceCollection()
.AddLogging(builder =>
{
builder.AddCerbiStream(options =>
{
options.EnableGovernance();
});
})
.BuildServiceProvider();
2️⃣ Running the Governance Analyzer
The analyzer automatically runs during the build process. If any logs do not meet governance standards, you’ll see build errors or warnings.
🎯 Future Enhancements
- Integration with CI/CD Pipelines – Enforce logging rules in GitHub Actions/Azure DevOps.
- Dashboard for Governance Management – UI to configure log governance dynamically.
- Multi-Project Support – Apply governance rules across microservices.
📜 License
CerbiStream-GovernanceAnalyzer is open-source under the MIT License.
📬 Contact & Contributions
We welcome contributions! Submit an issue or a pull request on GitHub.
Start enforcing structured logs today with CerbiStream-GovernanceAnalyzer! 🚀
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.CodeAnalysis.CSharp (>= 4.13.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.13.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.