Majo.Logging
0.0.1
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
<PackageReference Include="Majo.Logging" Version="0.0.1" />
<PackageVersion Include="Majo.Logging" Version="0.0.1" />
<PackageReference Include="Majo.Logging" />
paket add Majo.Logging --version 0.0.1
#r "nuget: Majo.Logging, 0.0.1"
#:package Majo.Logging@0.0.1
#addin nuget:?package=Majo.Logging&version=0.0.1
#tool nuget:?package=Majo.Logging&version=0.0.1
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 | Versions 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. |
-
net10.0
- Serilog (>= 4.4.0)
- Serilog.Sinks.Async (>= 2.1.0)
- Serilog.Sinks.File (>= 7.0.0)
-
net8.0
- Serilog (>= 4.4.0)
- Serilog.Sinks.Async (>= 2.1.0)
- Serilog.Sinks.File (>= 7.0.0)
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.
Initial release