Logging¶
Nalix.Logging provides the built-in logger implementation used across the Nalix stack.
Source mapping¶
src/Nalix.Logging/NLogix.cssrc/Nalix.Logging/NLogix.Host.cssrc/Nalix.Logging/NLogix.Extensions.cssrc/Nalix.Logging/Engine/NLogixDistributor.cs
Main types¶
NLogixNLogix.HostNLogixOptionsILoggerTarget
What it does¶
- implements
ILogger - supports multiple targets
- allows programmatic configuration
- works well as the shared logger registered through
InstanceManager
Basic usage¶
NLogix logger = NLogix.Host.Instance;
logger.Info("server-started");
logger.Warn("slow-handler");
logger.Error("dispatch-failed");
Custom setup¶
NLogix logger = new(cfg =>
{
cfg.SetMinimumLevel(LogLevel.Debug)
.RegisterTarget(new BatchConsoleLogTarget())
.RegisterTarget(new BatchFileLogTarget());
});
Typical integration¶
This is the usual pattern for server startup so listeners, dispatch, and framework services use the same logger instance.
Notes¶
- keep one shared logger for the process when possible
- prefer registering targets during startup, not mid-flight
- use
NLogix.Host.Instanceunless you have a good reason to own a separate logger graph