CerbiStream 1.0.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package CerbiStream --version 1.0.10
                    
NuGet\Install-Package CerbiStream -Version 1.0.10
                    
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" Version="1.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CerbiStream" Version="1.0.10" />
                    
Directory.Packages.props
<PackageReference Include="CerbiStream" />
                    
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 --version 1.0.10
                    
#r "nuget: CerbiStream, 1.0.10"
                    
#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&version=1.0.10
                    
Install CerbiStream as a Cake Addin
#tool nuget:?package=CerbiStream&version=1.0.10
                    
Install CerbiStream as a Cake Tool

CerbiStream Logging Library

NuGet NuGet Downloads License: MIT .NET Dev Friendly Governance Enforced CI/CD

CerbiStream is a next-generation logging solution built for structured logs, governance enforcement, and multi-destination routing. It ensures secure, consistent, and high-performance logging for cloud, on-prem, and hybrid environments.


πŸš€ What's New?

CerbiStream v1.0.9 introduces a modernized, simplified configuration model designed for speed, clarity, and real-world use cases.

πŸ”§ Major Improvements

  • New Preset Configuration Modes – Easily switch between DeveloperModeWithTelemetry, MinimalMode, or BenchmarkMode without manually toggling settings.
  • Cleaner Developer Experience – Legacy EnableDevMode() removed in favor of intuitive preset APIs.
  • Fine-Grained Controls – New methods like DisableConsoleOutput(), DisableGovernanceChecks(), and DisableMetadataInjection() provide precise control.
  • Better Benchmarking – BenchmarkMode() disables everything unnecessary for micro-benchmark testing.
  • Telemetry Separation – Decouple telemetry tracking from core logging logic with EnableTelemetryLogging().

These improvements reflect feedback from real production and OSS usageβ€”balancing governance enforcement with performance and flexibility.


🧰 Getting Started

CerbiStream works out-of-the-box. Install, configure, and start logging:

  1. Install the NuGet package
  2. Set your queue and enrichment metadata
  3. Start logging with ILogger<T>

β†’ For governance enforcement, install the GovernanceAnalyzer.


πŸ“¦ Installation

Install CerbiStream from NuGet:

dotnet add package CerbiStream

To enable governance validation:

dotnet add package CerbiStream.GovernanceAnalyzer

βš™οΈ Preset Config Modes

CerbiStream provides ready-to-use configuration presets:

Method Description
EnableDeveloperModeWithTelemetry() Console + metadata + telemetry (for dev/test)
EnableDeveloperModeWithoutTelemetry() Console + metadata, no telemetry (clean dev logs)
EnableDevModeMinimal() Console only (no metadata or telemetry) for benchmarks or POCs
EnableBenchmarkMode() All silent β€” disables output, telemetry, metadata, and governance

πŸ”§ Individual Configuration Options

For full control over behavior, you can toggle each capability manually:

Option Description
DisableConsoleOutput() Prevents log messages from appearing in local console
DisableTelemetryEnrichment() Disables automatic telemetry context injection (e.g., ServiceName, etc.)
DisableMetadataInjection() Skips adding common metadata fields (e.g., user type, retry count)
DisableGovernanceChecks() Bypasses governance schema validation on log structure
IncludeAdvancedMetadata() Adds environment/cloud-specific fields like region, version, etc.
IncludeSecurityMetadata() Adds security context fields, if applicable
SetTelemetryProvider() Manually inject a telemetry routing provider
EnableTelemetryLogging() Sends logs to telemetry independently of main log queue

Use these when building custom setups or combining multiple concerns.


⚑ Quick Start

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using CerbiStream;

var serviceProvider = new ServiceCollection()
    .AddLogging(builder =>
    {
        builder.AddConsole();
        builder.AddCerbiStream(options =>
        {
            options.SetQueue("RabbitMQ", "localhost", "logs-queue");
            options.EnableDeveloperModeWithoutTelemetry();

            TelemetryContext.ServiceName = "CheckoutService";
            TelemetryContext.OriginApp = "MyFrontendApp";
            TelemetryContext.UserType = "InternalUser";
        });
    })
    .BuildServiceProvider();

var logger = serviceProvider.GetRequiredService<ILogger<Program>>();
logger.LogInformation("App started");

πŸ”§ Dev Helper Shortcut

builder.AddDevLogging(); // applies EnableDeveloperModeWithoutTelemetry + telemetry context

🌐 Supported Logging Destinations

Queue Type Example Value
RabbitMQ "RabbitMQ"
Kafka "Kafka"
Azure Queue Storage "AzureQueue"
Azure Service Bus "AzureServiceBus"
AWS SQS "AWS_SQS"
AWS Kinesis "AWS_Kinesis"
Google Pub/Sub "GooglePubSub"

πŸ” Automatic Metadata Fields

Field Auto-Detected? Example
CloudProvider βœ… Azure
Region βœ… us-east-1
Environment βœ… Production
ApplicationVersion βœ… v1.2.3
RequestId βœ… abc123
TransactionType ❌ REST
TransactionStatus ❌ Success

βœ… Telemetry Context Fields

  • ServiceName
  • OriginApp
  • UserType
  • Feature
  • IsRetry
  • RetryAttempt

Set them once and they’ll enrich all logs.


πŸ” Retry Tracking Example

Policy
  .Handle<Exception>()
  .WaitAndRetry(3, _ => TimeSpan.FromSeconds(1), (ex, _, attempt, _) =>
  {
      TelemetryContext.IsRetry = true;
      TelemetryContext.RetryAttempt = attempt;
  });

πŸ” Governance Enforcement

CerbiStream supports structured logging enforcement via JSON rules. If governance is enabled, logs must match the schema.

{
  "LoggingProfiles": {
    "SecurityLog": {
      "RequiredFields": ["UserId", "IPAddress"],
      "OptionalFields": ["DeviceType"]
    }
  }
}

Use GovernanceAnalyzer to validate rules at build time.


πŸ“Š Telemetry Provider Support

Provider Supported?
Azure App Insights βœ…
AWS CloudWatch βœ…
GCP Trace βœ…
Datadog βœ…
OpenTelemetry (default) βœ…

Enable them via:

options.SetTelemetryProvider(new AppInsightsTelemetryProvider());

πŸ”Œ Multi-Telemetry Routing

Route different logs to different providers with governance config or custom logic:

{
  "TelemetryRouting": {
    "SecurityLogs": "Azure",
    "InfraLogs": "AWS"
  }
}

🧠 Why Use CerbiStream?

  • βœ… Structured logging & telemetry
  • βœ… No PII, ML/AI friendly
  • βœ… Preset modes for dev/test/benchmarks
  • βœ… Multi-cloud support
  • βœ… Enforced governance (optional)
  • βœ… Works with ILogger<T>

πŸ“œ License: MIT

πŸ“£ Want to contribute? Star the repo ⭐, open an issue πŸ›, or suggest a feature 🧠!

πŸ§‘β€πŸ’» Created by @Zeroshi

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.1.1 101 4/13/2025
1.1.0 105 4/13/2025
1.0.16 124 4/10/2025
1.0.15 126 4/7/2025
1.0.14 71 4/6/2025
1.0.13 102 3/28/2025
1.0.12 95 3/27/2025
1.0.11 430 3/26/2025
1.0.10 451 3/25/2025
1.0.9 126 3/23/2025
1.0.8 42 3/22/2025
1.0.7 106 3/21/2025
1.0.6 116 3/20/2025
1.0.5 118 3/20/2025
1.0.4 111 3/19/2025
1.0.3 110 3/19/2025
1.0.2 129 3/12/2025
1.0.1 119 3/12/2025