CerbiStream.GovernanceAnalyzer 1.0.1

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CerbiStream.GovernanceAnalyzer" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CerbiStream.GovernanceAnalyzer" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="CerbiStream.GovernanceAnalyzer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CerbiStream.GovernanceAnalyzer --version 1.0.1
                    
#r "nuget: CerbiStream.GovernanceAnalyzer, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.0.1
                    
Install CerbiStream.GovernanceAnalyzer as a Cake Addin
#tool nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.0.1
                    
Install CerbiStream.GovernanceAnalyzer as a Cake Tool

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

  1. 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"]
           }
       }
    }
    
  2. 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.
  3. 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.

🛠️ 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 112 3/28/2025
1.0.4 447 3/26/2025
1.0.3 141 3/23/2025
1.0.2 135 3/20/2025
1.0.1 191 3/19/2025
1.0.0 134 3/19/2025