Majo.Logging 0.0.1

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

Majo.Logging

A small, centralized logging wrapper for .NET applications.

Majo.Logging provides a compact static logging API built on Serilog, with configurable file logging, log levels, tags, exception output, log rolling, and asynchronous file writes.

Installation

dotnet add package Majo.Logging

The package targets .NET 10.

Quick Start

Initialize the logger once before normal application logging:

using Majo.Logging;

Logger.Initialize();

Logger.Information("Application started.");
Logger.Debug("Debug information.", "Startup");

Logger.Shutdown();

Logger.Shutdown() disposes the active logger and flushes the underlying logging pipeline.

Logging

Logger exposes one method for each supported log level:

Logger.Verbose("Verbose message.");
Logger.Debug("Debug message.");
Logger.Information("Information message.");
Logger.Warning("Warning message.");
Logger.Error("Error message.");
Logger.Fatal("Fatal message.");

The available levels are:

Level Output text
Verbose VERBOSE
Debug DEBUG
Information INFO
Warning WARN
Error ERROR
Fatal FATAL

Each logging method also accepts an optional tag and exception:

Logger.Error(
    "Failed to process the request.",
    "Network",
    new InvalidOperationException("Example exception"));

If no tag is supplied, the default tag is Common.

Configuration

Pass a LogOption to Logger.Initialize(...) when the defaults are not sufficient:

Logger.Initialize(new LogOption
{
    WriteToFile = true,
    FilePath = "logs/log_.log",
    FileLogLevel = LogLevel.Information,
    FileCountLimit = 14,
    FileSizeLimit = 5L * 1024 * 1024
});
Option Default Description
WriteToFile true Enables or disables file logging.
FilePath null File path used for log output. When null or whitespace, the default path is used.
FileLogLevel Debug Minimum level written to the log file.
FileCountLimit 30 Maximum number of retained log files.
FileSizeLimit 10 MiB Maximum file size before size-based rolling.

When FilePath is null or whitespace, logs are written under:

<AppContext.BaseDirectory>/log_.log

Parent directories are created automatically when necessary.

File Output

The file output format is:

[yyyy-MM-dd HH:mm:ss] [LEVEL] [Tag] Message
Exception

For example:

[2026-09-26 17:00:00] [INFO] [Common] Application started.

File logging uses:

  • daily rolling;
  • size-based rolling using FileSizeLimit;
  • retention using FileCountLimit;
  • asynchronous writes through Serilog's async sink.

Initialization and Shutdown

Majo.Logging uses a single process-wide static logger.

Calling Logger.Initialize(...) again while the logger is already initialized has no effect.

Calling Logger.Shutdown() when the logger is not initialized also has no effect.

After shutdown, the logger can be initialized again with a new configuration.

Applications should call Logger.Shutdown() during normal termination so pending asynchronous log output can be completed.

Logging Before Initialization

Calls made before Logger.Initialize(...), or after Logger.Shutdown(), do not create a log file.

Instead, Majo.Logging writes a fallback representation through System.Diagnostics.Debug.WriteLine(...).

Dependencies

Majo.Logging is built on:

  • Serilog
  • Serilog.Sinks.Async
  • Serilog.Sinks.File

These dependencies are kept behind the Majo.Logging API so application code normally only needs to interact with Logger, LogOption, and LogLevel.

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 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Majo.Logging:

Package Downloads
Majo.TerminalUI

A small terminal interaction layer for .NET console applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.3 248 10/2/2026
0.0.2 160 9/30/2026
0.0.1 122 9/26/2026

Initial release