This guide helps teams move from Microsoft.Extensions.Logging (MEL) patterns to XenoAtom.Logging.
XenoAtom.Logging is not a MEL provider/bridge today.
Migration is API-level: update startup configuration and logging call sites.
| MEL concept | XenoAtom.Logging concept |
|---|---|
ILogger<TCategoryName> |
Logger from LogManager.GetLogger("Category") |
ILoggerFactory / provider pipeline |
LogManager.Initialize(...) with configured writers |
LogLevel |
LogLevel |
EventId |
LogEventId |
BeginScope(...) |
BeginScope(LogProperties) |
LoggerMessageAttribute |
[LogMethod] |
appsettings provider config |
LogManagerConfig + code configuration |
builder.Services.AddLogging(logging =>
{
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
logging.AddConsole();
});
using XenoAtom.Logging;
using XenoAtom.Logging.Writers;
var config = new LogManagerConfig
{
RootLogger =
{
MinimumLevel = LogLevel.Info,
Writers =
{
new StreamLogWriter(Console.OpenStandardOutput())
}
}
};
LogManager.Initialize(config);
MEL LoggerMessageAttribute:
[LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "Processing item {ItemId}")]
public static partial void ProcessingItem(ILogger logger, int itemId);
XenoAtom.Logging equivalent:
using XenoAtom.Logging;
public static partial class AppLog
{
[LogMethod(LogLevel.Info, "Processing item {itemId}", EventId = 1)]
public static partial void ProcessingItem(Logger logger, int itemId);
}
See Source-generated Logging for full generator rules.
MEL scope style:
using (_logger.BeginScope("Request {RequestId}", requestId))
{
_logger.LogInformation("Handling request");
}
XenoAtom.Logging style:
using (logger.BeginScope(new LogProperties { ("RequestId", requestId) }))
{
logger.Info("Handling request");
}
Per-message properties are explicit and allocation-aware:
logger.Info(
properties: new LogProperties { ("UserId", 42), ("Feature", "checkout") },
msg: "Validation failed");
MEL provider behavior depends on each provider implementation.
XenoAtom.Logging exposes explicit async queue settings:
InitializeForAsync(config)AsyncLogMessageQueueCapacityOverflowMode (Drop, DropAndNotify, Block, Allocate)AsyncErrorHandlerUse Block when correctness is more important than producer latency.
LogManager startup/shutdown lifecycle.Logger access (LogManager.GetLogger(...)) at app entry points/services.[LogMethod] or interpolated APIs.FileLogWriter/JsonFileLogWriter/TerminalLogWriter as needed.LogManager.Shutdown() on process exit (can lose buffered writes).Drop overflow in critical audit paths.See Thread Safety and Shutdown Semantics for operational guidance.