Cerbi.MEL.Governance 1.0.31

There is a newer version of this package available.
See the version list below for details.
dotnet add package Cerbi.MEL.Governance --version 1.0.31
                    
NuGet\Install-Package Cerbi.MEL.Governance -Version 1.0.31
                    
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="Cerbi.MEL.Governance" Version="1.0.31" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cerbi.MEL.Governance" Version="1.0.31" />
                    
Directory.Packages.props
<PackageReference Include="Cerbi.MEL.Governance" />
                    
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 Cerbi.MEL.Governance --version 1.0.31
                    
#r "nuget: Cerbi.MEL.Governance, 1.0.31"
                    
#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.
#:package Cerbi.MEL.Governance@1.0.31
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cerbi.MEL.Governance&version=1.0.31
                    
Install as a Cake Addin
#tool nuget:?package=Cerbi.MEL.Governance&version=1.0.31
                    
Install as a Cake Tool

Cerbi.MEL.Governance (Working Version)

Demo & Examples: https://github.com/Zeroshi/Cerbi.MEL.Governance

Real-time logging governance enforcement for Microsoft.Extensions.Logging (MEL) using the Cerbi validation engine.

🚧 Note: This release is a working version that always emits two console lines per log entry—one for the original message and one for governance verification. Future improvements will only emit the secondary log when violations occur. We’re also planning a dedicated Relax() helper for relaxed mode, pending MEL plugin constraints.

We’ve been thrilled—and a bit surprised—by nearly 2,000 downloads in just a few days since this was quietly released. Thank you for your patience and feedback as we continue improving this project!

Cerbi.MEL.Governance is part of the Cerbi suite. It enables runtime validation of log fields based on structured governance profiles. Built for ASP.NET Core, Worker Services, Azure Functions, and any .NET app using Microsoft.Extensions.Logging.


📂 Demo

See the sample implementation in our Demo & Examples Repository.


🚀 Features (Current Scope)

  • ✅ Enforce required and forbidden fields
  • ✅ Drop or tag logs with governance violations (always writes a second line for verification)
  • ✅ Supports structured logging and BeginScope
  • ✅ Supports [CerbiTopic("...")] profile routing via caller class detection (injected CerbiTopic field)
  • ✅ Compatible with any MEL-compatible sink (Console, File, Seq, etc.)

⚠️ Note: “Relaxed mode” (AllowRelax) can be toggled via configuration and will mark entries as relaxed when a structured Relax = true field is provided. A dedicated Relax() helper method is not available in this release but may be introduced in a future version.


📆 Installation

dotnet add package Cerbi.MEL.Governance

🛠 Setup

1. Add a governance config file

{
  "EnforcementMode": "Strict",
  "LoggingProfiles": {
    "Orders": {
      "FieldSeverities": {
        "userId": "Required",
        "email": "Required",
        "password": "Forbidden"
      },
      "AllowRelax": true,
      "RequireTopic": true,
      "AllowedTopics": ["Orders"]
    }
  }
}

Save this as cerbi_governance.json in your project root.

2. Configure MEL to use Cerbi governance

using Microsoft.Extensions.Logging;
using Cerbi.MEL.Governance;

builder.Logging.AddCerbiGovernance(options =>
{
    options.Profile = "Orders";      // default fallback topic
    options.ConfigPath = "cerbi_governance.json";
    options.Enabled = true;            // enable or disable governance at runtime
});

🔹 Optional: Use [CerbiTopic("...")] to route logs to specific profiles

[CerbiTopic("Orders")]
public class OrderService
{
    private readonly ILogger<OrderService> _logger;

    public OrderService(ILogger<OrderService> logger)
    {
        _logger = logger;
    }

    public void Process()
    {
        _logger.LogInformation("Order processed for {userId}", "abc123");
    }
}

✅ The [CerbiTopic] attribute automatically injects a CerbiTopic field at runtime. Logs emitted from this class will be validated against the "Orders" profile.


✍️ Example Logging

_logger.LogInformation("User info: {userId} {email}", "abc123", "test@example.com");

// Missing userId → governance violation under "Orders"
_logger.LogInformation("Only email provided: {email}", "test@example.com");

// Forbidden field (password) → governance violation under "Orders"
_logger.LogInformation("Password in log: {userId} {email} {password}", "abc123", "test@example.com", "secret");

// Relaxed example (when AllowRelax = true in config):
_logger.LogInformation("Email-only (relaxed): {email} {Relax}", "user@example.com", true);

🧐 Governance Output

When governance enrichment is enabled, the plugin always writes a JSON payload on a second line. Examples:

  1. Violation example (missing required field):
{
  "GovernanceProfileUsed": "Orders",
  "GovernanceViolations": ["MissingField:userId"],
  "GovernanceRelaxed": false
}
  1. Forbidden field example:
{
  "GovernanceProfileUsed": "Orders",
  "GovernanceViolations": ["ForbiddenField:password"],
  "GovernanceRelaxed": false
}
  1. Relaxed example (AllowRelax = true, Relax=true passed):
{
  "email": "user@example.com",
  "CerbiTopic": "Orders",
  "GovernanceRelaxed": true,
  "GovernanceProfileUsed": "Orders"
}

SBOM & Compliance

Cerbi.MEL.Governance is safe for use in secure logging pipelines. No outbound calls. MIT licensed. All governance logic is internal and validated at runtime.


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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.37 151 6/5/2025
1.0.35 139 6/4/2025
1.0.34 130 6/4/2025
1.0.33 138 6/4/2025
1.0.32 145 6/4/2025
1.0.31 95 6/1/2025
1.0.30 100 6/1/2025
1.0.29 95 6/1/2025
1.0.28 107 5/31/2025
1.0.27 105 5/31/2025
1.0.26 103 5/31/2025
1.0.25 99 5/31/2025
1.0.24 100 5/31/2025
1.0.23 105 5/31/2025
1.0.22 70 5/31/2025
1.0.21 78 5/31/2025
1.0.20 75 5/31/2025
1.0.19 70 5/31/2025
1.0.18 65 5/31/2025
1.0.17 70 5/30/2025
1.0.16 69 5/30/2025
1.0.15 149 5/27/2025
1.0.14 140 5/27/2025
1.0.13 141 5/27/2025
1.0.12 148 5/26/2025
1.0.11 143 5/26/2025
1.0.10 140 5/26/2025
1.0.9 148 5/26/2025
1.0.8 142 5/26/2025
1.0.7 145 5/26/2025
1.0.6 143 5/26/2025
1.0.5 143 5/26/2025
1.0.4 146 5/26/2025
1.0.3 149 5/26/2025
1.0.2 146 5/26/2025
1.0.1 141 5/26/2025
1.0.0 144 5/26/2025