Cerbi.MEL.Governance 1.0.17

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.17
                    
NuGet\Install-Package Cerbi.MEL.Governance -Version 1.0.17
                    
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.17" />
                    
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.17" />
                    
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.17
                    
#r "nuget: Cerbi.MEL.Governance, 1.0.17"
                    
#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.17
                    
#: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.17
                    
Install as a Cake Addin
#tool nuget:?package=Cerbi.MEL.Governance&version=1.0.17
                    
Install as a Cake Tool

Cerbi.MEL.Governance (In Draft)

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

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.


🚀 Features

  • ✅ Enforce required and forbidden fields
  • ✅ Drop or tag logs with governance violations
  • ✅ Allow relaxed logs (Relax() mode)
  • ✅ Supports structured logging and BeginScope
  • ✅ Supports [CerbiTopic("...")] profile routing via caller class detection (using injected CerbiTopic field)
  • ✅ Compatible with any MEL-compatible sink (Console, File, Seq, etc.)

📆 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
    options.ConfigPath = "cerbi_governance.json";
});

🔹 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");
    }
}

✅ This works via automatic injection of the topic into the log fields. The logger sets the CerbiTopic field at runtime if the caller class has the [CerbiTopic("...")] attribute.


✍️ Example Logging

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

// Violates governance (missing userId)
logger.LogInformation("Only email provided: {email}", "test@example.com");

// Forbidden field
logger.LogInformation("Password in log: {userId} {email} {password}", "abc123", "test@example.com", "secret");

🧐 Governance Output

If governance enrichment is enabled, the logger can tag entries like:

{
  "GovernanceProfileUsed": "Orders",
  "GovernanceViolations": ["MissingField:userId"],
  "GovernanceRelaxed": false
}

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 150 6/5/2025
1.0.35 138 6/4/2025
1.0.34 129 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 106 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 76 5/31/2025
1.0.20 73 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 68 5/30/2025
1.0.15 148 5/27/2025
1.0.14 139 5/27/2025
1.0.13 140 5/27/2025
1.0.12 146 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 142 5/26/2025
1.0.5 143 5/26/2025
1.0.4 146 5/26/2025
1.0.3 148 5/26/2025
1.0.2 146 5/26/2025
1.0.1 141 5/26/2025
1.0.0 144 5/26/2025