MaverickLogging 1.0.0

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

Maverick.Logging

A standardized, production-ready logging package for .NET applications built on Microsoft.Extensions.Logging and Serilog.


Overview

Maverick.Logging provides a consistent logging implementation across all applications with:

  • Structured logging via Serilog
  • Rolling file logs
  • Dedicated error logs
  • Domain-specific logs (IMAP, SECURITY)
  • Runtime log level switching (no restart required)
  • Clean integration with ILogger<T>

Installation

From Local NuGet Source

dotnet add package Maverick.Logging --source LocalNuget

Or via Visual Studio:

  1. Go to Tools → NuGet Package Manager → Package Manager Settings
  2. Add a new source:
    • Name: LocalNuget
    • Source: C:\Maverick\Nuget (or your configured path)
  3. Install Maverick.Logging

Quick Start (Required Setup)

In Program.cs:

using Maverick.Logging;

var builder = WebApplication.CreateBuilder(args);

var logRoot = Path.Combine(
    builder.Environment.ContentRootPath,
    "Logs");

builder.Logging.AddMaverickLogging(
    builder.Environment,
    builder.Configuration,
    logRoot,
    builder.Environment.ApplicationName);

Output Structure

Logs are written to:

<ContentRoot>\Logs\

Files generated:

File Purpose
AppName-YYYYMMDD.log All log events
Error-YYYYMMDD.log Errors only
IMAP-YYYYMMDD.log IMAP-specific events
Security-YYYYMMDD.log Security events

Logging Usage

Standard Logging

logger.LogInformation("Application started");

Error Logging

logger.LogError(ex, "Unhandled exception occurred");

IMAP Logging (Custom Channel)

logger
    .ForContext("IMAP", true)
    .Information("Connected to mailbox");

Security Logging (Custom Channel)

logger
    .ForContext("SECURITY", true)
    .Warning("Unauthorized access attempt");

Log Levels by Environment

Environment Default Level
Development Debug
Staging Information
Production Warning

Dynamic Log Level Changes

You can change logging levels at runtime via appsettings.json.

{
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information"
    }
  }
}

Requires reloadOnChange: true in configuration.


Filtering Behavior

The following noisy categories are suppressed by default:

  • Microsoft → Warning+
  • System → Warning+
  • Microsoft.Hosting.Lifetime → Disabled
  • Kestrel → Disabled

Developer Requirements

To use this package correctly:

  1. Always inject ILogger<T>
  2. Use structured logging (avoid string concatenation)
  3. Use context properties for domain-specific logs (IMAP, SECURITY)

Example

public class EmailService
{
    private readonly ILogger<EmailService> _logger;

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

    public void Connect()
    {
        _logger.ForContext("IMAP", true)
               .Information("Connecting to IMAP server");
    }
}

Versioning Strategy

  • Patch: Bug fixes
  • Minor: Backward-compatible enhancements
  • Major: Breaking changes

  • Do not log sensitive data (passwords, tokens)
  • Use LogError for exceptions (always include ex)
  • Prefer structured logging:
logger.LogInformation("User {UserId} logged in", userId);

Troubleshooting

Logs not appearing

  • Verify logRoot path exists
  • Ensure app has write permissions
  • Confirm package is installed

Log level not updating

  • Ensure reloadOnChange = true
  • Verify correct JSON path: Serilog:MinimumLevel:Default

Future Enhancements (Planned)

  • Correlation ID middleware
  • Distributed tracing support
  • Optional sinks (Seq, Elastic, App Insights)

Ownership

Maintained by Maverick development team.

For changes, update the package and increment version in .csproj.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.0 227 3/29/2026