Diagnostics Contracts¶
Nalix.Common.Diagnostics defines the core logging contracts used across the stack.
Source mapping¶
src/Nalix.Common/Diagnostics/ILogger.cssrc/Nalix.Common/Diagnostics/ILoggerTarget.cssrc/Nalix.Common/Diagnostics/ILogDistributor.cs
Main types¶
ILoggerILoggerTargetILogDistributor
ILogger¶
ILogger is the main logging abstraction used by framework, network, SDK, and logging components.
It exposes methods such as:
Trace(...)Debug(...)Info(...)Warn(...)Error(...)Fatal(...)
ILoggerTarget¶
ILoggerTarget is the sink contract. A target receives a LogEntry and decides how it is stored or displayed.
Typical examples:
- console output
- file output
- remote logging target
ILogDistributor¶
ILogDistributor is the fan-out abstraction that pushes one log entry to many targets.
It supports:
RegisterTarget(...)UnregisterTarget(...)Publish(...)PublishAsync(...)
Example¶
ILogger logger = InstanceManager.Instance.Get<ILogger>();
logger.Info("listener started on port {Port}", 57206);
logger.Warn("throttle activated for {Endpoint}", endpoint);
logger.Error(ex, "dispatch failed for {ConnectionId}", connectionId);