CerbiStream 1.1.19

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

CerbiStream: Dev-Friendly, Governance-Enforced Logging for .NET

Brought to you by Cerbi LLC, your trusted partner in enterprise observability.

πŸš€ View CerbiStream Benchmarks Compare against Serilog, NLog, and others. CerbiStream is engineered for high performance, strict governance, and enterprise-grade log routing.

CerbiStream NuGet CerbiStream Downloads Governance Analyzer NuGet Governance Analyzer Downloads Build Status Quality Gate Status

Benchmark Tests Repo License: MIT


πŸ”— Supported Destinations

CerbiStream can route logs to:

  • Queues: Azure Service Bus, RabbitMQ, Kafka, AWS SQS/Kinesis, Google Pub/Sub
  • HTTP Endpoints: Any REST API with custom headers
  • Cloud Storage: Azure Blob, AWS S3, Google Cloud Storage
  • File Fallback: Local JSON file (AES/Base64 encryption supported)
  • Telemetry Providers: App Insights, OpenTelemetry, Datadog, AWS CloudWatch, GCP Stackdriver

🧱 CerbiSuite Overview

Component Purpose
CerbiStream Structured logging for .NET with queue & cloud targets
Cerbi.Governance.Runtime Runtime enforcement of governance rules
CerbiStream.GovernanceAnalyzer Compile-time governance analyzer
CerbiShield (coming soon) Governance dashboard & deployment portal
CerbIQ (coming soon) Metadata aggregation + routing pipeline
CerbiSense (coming soon) Governance scoring & ML analysis engine

πŸ“š Table of Contents


πŸ†• 2025 Governance Update

CerbiStream now uses real-time governance enforcement via Cerbi.Governance.Runtime, removing most limitations of build-time validation.

βœ… Runtime Advantages:

  • Compatible with .NET 6–8+
  • Config from local, blob, or GitHub
  • Automatically tags logs with governance info
  • Supports .Relax() and [CerbiTopic]

⚠️ Build-Time Analyzer Limitations:

  • Requires local files and static references
  • Not compatible with CI or dynamic config

πŸ”„ Recent Updates (v1.1.16)

  • βœ… Async console logging via Channel<string>

    • Dramatically improves performance during high-volume console logging
    • Enable using .WithAsyncConsoleOutput(true)
    • Automatically wired via AddCerbiStream(...)
  • Unified enrichment with LogId, ApplicationId, InstanceId, etc.

  • Full-payload encryption using AES or Base64

  • File fallback with encryption support (AES/Base64)

  • Queue + cloud routing (HTTP, Blob, etc.)

  • Built-in governance validation via Cerbi.Governance.Runtime

  • Topic tagging with [CerbiTopic] and relaxed logging via .Relax()


Here is the updated README section that includes your new async console logging support. This makes it clear to developers that CerbiStream supports background-buffered logging for high-performance scenarios, just like Serilog's async sink:


CerbiStream now supports async console output using a high-performance background channel dispatcher. This significantly improves logging throughput, especially during bursts or heavy load.

βœ… Runtime Enhancements
  • Async Console Dispatch: Offloads Console.WriteLine to a background thread using Channel<string> β€” 10x+ faster under load.
  • Enable via Fluent API: .WithAsyncConsoleOutput(true)
  • Auto-wired via AddCerbiStream(...): No boilerplate needed in Program.cs
  • Compatible with Relax() and governance enforcement
  • Zero impact on telemetry, queue, or file fallback behavior
builder.Logging.AddCerbiStream(options =>
{
    options.WithAsyncConsoleOutput(true)
           .WithGovernanceChecks(true)
           .EnableDeveloperModeWithoutTelemetry();
});

πŸ”§ This uses the same async model as Serilog.Sinks.Async for performance, ensuring non-blocking log flow even when console is enabled.


πŸ“ˆ Performance Impact

CerbiStream with async console enabled matches or exceeds Serilog's async throughput for console scenarios.

Scenario Sync Console Async Console
Avg Time per Log (Β΅s) ~45–100 ~2–5
Caller Thread Blocked? βœ… Yes ❌ No
Throughput Under Load ❌ Chokes βœ… Smooth
Comparable to Serilog.Async ❌ No βœ… Yes

Developer Quick Start

πŸ‘‰ Quick Start Guide

🧰 Developer Setup Matrix

Scenario Method(s) Used Description
πŸ”Ή Basic Dev (No Governance) EnableDevModeMinimal() Minimal config, console only
πŸ”Έ Dev + Governance EnableDeveloperModeWithoutTelemetry() + .WithGovernanceChecks(true) Runtime enforcement, no telemetry
🟒 Dev + Governance + Telemetry EnableDeveloperModeWithTelemetry() + .WithGovernanceChecks(true) + .WithTelemetryProvider(...) Full stack logging with runtime governance and telemetry
πŸ§ͺ Benchmarking EnableBenchmarkMode() Disables all enrichments for performance tests
πŸ› οΈ Production EnableProductionMode() + .WithQueue(...) + .WithEncryptionMode(...) Production-ready config with security and routing

πŸ”Ή Basic Development (No Governance)

builder.Logging.AddCerbiStream(options =>
{
    options.EnableDevModeMinimal();
});

πŸ”Έ Development with Real-Time Governance

builder.Logging.AddCerbiStream(options =>
{
    options.WithFileFallback("cerbi_fallback.json")
           .WithGovernanceChecks(true)
           .WithGovernanceProfile("default")
           .EnableDeveloperModeWithoutTelemetry();
});

🟒 Development with Governance + Telemetry

builder.Logging.AddCerbiStream(options =>
{
    options.WithQueue("AzureServiceBus", "Endpoint=sb://...", "log-queue")
           .WithEncryptionMode(EncryptionType.Base64)
           .WithGovernanceChecks(true)
           .WithTelemetryProvider(
               TelemetryProviderFactory.CreateTelemetryProvider("appinsights")
           )
           .EnableDeveloperModeWithTelemetry();
});

---

## Advanced Setup & Best Practices

πŸ‘‰ [Advanced Setup Guide](LoggingStandards/README-CerbiStream–AdvancedSetup&BestPractices.md)

---

## Overview

CerbiStream is a developer-first logging library built for performance, security, and governance enforcement.

---

## Highlights

- Async, queue-first architecture
- Flexible encryption
- Runtime governance validation
- Low object allocation
- Azure/GCP/AWS-aware metadata

---

## βš™οΈ Configuration Options

- `.WithQueue(...)`
- `.WithEncryptionMode(...)`
- `.WithFileFallback(...)`
- `.WithGovernanceChecks(...)`
- `.EnableDeveloperModeWithTelemetry()`

### Encryption Types
- `None`
- `Base64`
- `AES`

### Config Sources
- Local JSON
- Azure Blob / AWS S3 / GCP
- GitHub raw URL

---

## Features

- Topic-based log scoping
- Metadata injection
- Governance policy validation
- Relaxed log support
- Queue & blob transport
- Polly retry support

---

## Governance and Compliance

- Runtime enforcement with `Cerbi.Governance.Runtime`
- Analyzer available for CI validation
- Tags include `GovernanceProfileUsed`, `GovernanceViolations`, etc.

---

## Advanced Metadata & Encryption

```csharp
options.WithMetadataInjection(true)
       .WithEncryptionMode(EncryptionType.AES)
       .WithEncryptionKey(key, iv);

JSON logs are fully encrypted before sending.


Usage Examples

  • Relaxed logging: logger.Relax()
  • Topic assignment: [CerbiTopic("Payments")]
  • Fallback to file: .WithFileFallback("fallback.json")
  • Multi-cloud: auto-populates cloud provider

πŸ”“ Relaxed Logging Modes

Cerbi supports two forms of relaxed logging to bypass governance rules when explicitly intended:

Mode Description Usage Example Fluent .Relax() Developer-triggered, scoped for individual log statements logger.Relax().LogInformation("...") Runtime .RelaxGovernance() Global override, wraps logger during startup configuration logger = logger.RelaxGovernance();

πŸ§‘β€πŸ’» Developer Inline (Fluent API):

var logger = builder.Logging.CreateLogger("MyApp");
logger = logger.RelaxGovernance(); // All logs now include GovernanceRelaxed: true

This uses CerbiLoggerWrapper for structured logging, useful during development or for logs intentionally excluded from governance enforcement.

βš™οΈ Runtime Setup Override:

var logger = builder.Logging.CreateLogger("MyApp");
logger = logger.RelaxGovernance(); // All logs now include GovernanceRelaxed: true

Integration & Supported Platforms

  • Queues: RabbitMQ, Azure, Kafka, etc.
  • HTTP REST APIs
  • Azure Blob, AWS S3, GCP Storage
  • Auto-detect metadata from cloud env vars

Telemetry Provider Support

Provider Activation Code
App Insights CreateTelemetryProvider("appinsights")
OpenTelemetry ...("opentelemetry")
AWS CloudWatch ...("awscloudwatch")
Datadog ...("datadog")
GCP Stackdriver ...("gcpstackdriver")

Benchmark vs Serilog

Metric CerbiStream Serilog
Log Throughput >50K logs/sec 10–30K logs/sec
Encryption Native, full JSON External libs required
Memory per log ~1–3 KB ~10–30 KB
Governance Built-in Requires plugin stack

Unit Testing

Covers:

  • Governance rule enforcement
  • Retry/backoff
  • Metadata injection
  • Fallback logging rotation
  • Encryption and validation

Contributing

PRs welcome! Please open an issue first for large features. Follow code style and ensure tests pass.


Community & Support


πŸ“Œ Under the Hood: Runtime Defaults & Utilities

   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  log   β”‚
   β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ enrich   │◄───┐
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β”‚
       β–Ό          β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
  β”‚ encrypt  β”‚     β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β”‚
       β–Ό          β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
  β”‚ validate β”‚     β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β”‚
       β–Ό          β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
  β”‚  send    β”‚β”€β”€β”€β”€β”€β”˜
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β–²
       β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ RetryPolicy  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

CerbiStream includes helpful built-in utilities and conventions:

☁️ Cloud Metadata Detection

Pulled from environment variables using ApplicationMetadata:

  • CloudProvider resolves from AWS, Azure, or GCP.
  • Region is inferred from cloud-specific variables.
  • InstanceId and ApplicationVersion are auto-filled.

πŸ› οΈ Central Config Convenience

Use CerbiStreamConfig for:

  • Single-file config initialization
  • Auto-detected cloud + env context
  • Runtime feature toggles (e.g., encryption, telemetry)

πŸ” Retry Behavior

Retry logic for queue delivery is powered by Polly:

RetryPolicyFactory.Create(3, 200); // Retries 3x with 200ms delay

This is used when .WithQueueRetries(...) is enabled.

πŸ“‘ Telemetry Integration

Quickly wire up telemetry providers with:

TelemetryProviderFactory.CreateTelemetryProvider("appinsights");

Supported options include AppInsights, OpenTelemetry, Datadog, AWS CloudWatch, and GCP Stackdriver.


Here’s the addition you can include in your README.md under a new section like ## πŸ™ Acknowledgments or within your ## πŸ”„ Recent Updates or ## πŸ§ͺ Benchmarks section:


πŸ™ Acknowledgments

Special thanks to @snakefoot for the performance insights and benchmark contributions across popular logging frameworks:

  • βœ… Microsoft Console Logger uses an asynchronous queue by default.
  • ⚠️ Serilog Console writes synchronously β€” causing slower results unless async sinks are used.
  • βœ… NLog and Log4Net support async file targets out of the box, yielding faster logging performance.
  • πŸ§ͺ These contributions helped improve CerbiStream's own async capabilities.

Let me know if you'd like this rendered into a Markdown table with benchmark chart screenshots or badges.

License

MIT Β© Cerbi LLC

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.1.19 42 7/4/2025
1.1.18 140 5/20/2025
1.1.17 137 5/20/2025
1.1.16 140 5/20/2025
1.1.15 97 5/18/2025
1.1.14 220 5/15/2025
1.1.13 217 5/14/2025
1.1.12 227 5/14/2025
1.1.11 219 5/14/2025
1.1.10 221 5/14/2025
1.1.9 225 5/13/2025
1.1.8 236 5/13/2025
1.1.7 138 5/6/2025
1.1.6 159 4/27/2025
1.1.5 151 4/27/2025
1.1.3 128 4/27/2025
1.1.2 145 4/25/2025
1.1.1 182 4/13/2025
1.1.0 177 4/13/2025
1.0.16 140 4/10/2025
1.0.15 141 4/7/2025
1.0.14 94 4/6/2025
1.0.13 118 3/28/2025
1.0.12 110 3/27/2025
1.0.11 446 3/26/2025
1.0.10 467 3/25/2025
1.0.9 135 3/23/2025
1.0.8 54 3/22/2025
1.0.7 115 3/21/2025
1.0.6 126 3/20/2025
1.0.5 132 3/20/2025
1.0.4 122 3/19/2025
1.0.3 123 3/19/2025
1.0.2 141 3/12/2025
1.0.1 133 3/12/2025