CerbiStream 1.0.13

dotnet add package CerbiStream --version 1.0.13
                    
NuGet\Install-Package CerbiStream -Version 1.0.13
                    
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.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CerbiStream" Version="1.0.13" />
                    
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.13
                    
#r "nuget: CerbiStream, 1.0.13"
                    
#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.13
                    
Install CerbiStream as a Cake Addin
#tool nuget:?package=CerbiStream&version=1.0.13
                    
Install CerbiStream as a Cake Tool

CerbiStream: Dev-Friendly Logging for .NET

NuGet Downloads License .NET

Dev Friendly Governance Enforced

Cerbi CI Quality Gate

πŸš€ View CerbiStream Benchmarks

Compare against Serilog, NLog, and others. CerbiStream is tuned for performance, governance, and enterprise-scale routing.


βœ… Highlights

  • Works with ILogger<T>
  • Structured logging enforcement
  • Supports RabbitMQ, Kafka, Azure, AWS, GCP queues
  • Flexible encryption (None, Base64, AES)
  • Schema enforcement with GovernanceAnalyzer
  • πŸ” Queue-first architecture (sink-agnostic)

✨ What's New in v1.0.11

  • New presets: BenchmarkMode(), EnableDeveloperModeWithTelemetry()
  • Toggle: telemetry, console, metadata, governance
  • JSON conversion with encryption
  • Queue routing using enums

🧰 Install

dotnet add package CerbiStream

Optional governance analyzer:

dotnet add package CerbiStream.GovernanceAnalyzer

⚑ Quick Start

builder.Logging.AddCerbiStreamWithRouting(options =>
{
    options.WithQueue("RabbitMQ", "localhost", "logs-queue")
           .EnableDeveloperModeWithoutTelemetry()
           .WithEncryptionMode(EncryptionType.Base64);
});

πŸ” Runtime Encryption

options.WithEncryptionMode(EncryptionType.AES)
       .WithEncryptionKey(myKey, myIV);

Default (lazy) test keys:

var (key, iv) = EncryptionHelpers.GetInsecureDefaultKeyPair();
options.WithEncryptionKey(key, iv);

KeyVault example:

var key = Convert.FromBase64String(await secretClient.GetSecret("CerbiKey"));
var iv = Convert.FromBase64String(await secretClient.GetSecret("CerbiIV"));

πŸ› οΈ Preset Modes

Method Description
EnableDeveloperModeWithTelemetry() Console + telemetry + metadata
EnableDeveloperModeWithoutTelemetry() Console + metadata, no telemetry
EnableDevModeMinimal() Console only
EnableBenchmarkMode() Silent mode (no telemetry, queue, or console)

πŸ” Retry Example

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

πŸ”§ Configuration Options

Option Description
.WithQueue(...) Configure queue host, name, and type
.DisableQueue() Stops sending logs to queues
.WithTelemetryProvider() Set custom telemetry provider
.IncludeSecurityMetadata() Adds IP/UserID info
.EnableTelemetryLogging() Sends to telemetry even if queue is disabled

πŸ“Š Telemetry Provider Support

Provider Supported
OpenTelemetry βœ…
Azure App Insights βœ…
AWS CloudWatch βœ…
GCP Trace βœ…
Datadog βœ…

πŸ“˜ Code Samples

CerbiLoggerBuilder

var logger = new CerbiLoggerBuilder()
    .UseAzureServiceBus("<conn>", "<queue>")
    .EnableDebugMode()
    .Build(logger, new ConvertToJson(), new NoOpEncryption());

Fluent API

var options = new CerbiStreamOptions()
    .WithEncryptionMode(EncryptionType.Base64)
    .WithQueue("RabbitMQ", "localhost", "logs");

AddCerbiStreamWithRouting (DI)

builder.Logging.AddCerbiStreamWithRouting(options =>
{
    options.WithQueue("AzureServiceBus", "sb://...", "queue")
           .WithEncryptionMode(EncryptionType.AES);
});

πŸ§ͺ Unit Test Example

var mockQueue = Substitute.For<IQueue>();
var logger = new Logging(Substitute.For<ILogger<Logging>>(), mockQueue, new ConvertToJson(), new NoOpEncryption());

var result = await logger.LogEventAsync("Test", LogLevel.Information);
Assert.True(result);

🌐 Supported Queues

  • RabbitMQ
  • Kafka
  • Azure Queue / Service Bus
  • AWS SQS / Kinesis
  • Google Pub/Sub

🧡 Queue-First Logging (Sink-Agnostic)

CerbiStream does not directly send logs to sinks like Splunk, Elastic, or Blob.

Instead:

  • πŸ” Logs are emitted to queues only (Kafka, RabbitMQ, Azure, etc.)
  • 🧠 CerbIQ reads from these queues and sends logs to sinks
  • βœ… Keeps log generation decoupled from log delivery

This design gives you:

  • Better performance
  • Retry-friendly resilience
  • Pluggable downstream integrations

➑️ Add CerbIQ to handle routing and sink delivery.


πŸ” Governance Enforcement (Optional)

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

πŸ“œ License

MIT


Star the repo ⭐ β€” Contribute πŸ”§ β€” File issues πŸ›

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.0.13 92 3/28/2025
1.0.12 91 3/27/2025
1.0.11 424 3/26/2025
1.0.10 447 3/25/2025
1.0.9 121 3/23/2025
1.0.8 38 3/22/2025
1.0.7 102 3/21/2025
1.0.6 112 3/20/2025
1.0.5 114 3/20/2025
1.0.4 110 3/19/2025
1.0.3 110 3/19/2025
1.0.2 129 3/12/2025
1.0.1 119 3/12/2025