Class LogProvider
Provides a static interface for logging functionality across the application.
public static class LogProvider
- Inheritance
-
LogProvider
- Inherited Members
Remarks
As a static class, it cannot be instantiated or inherited and is intended to expose logging operations as shared members.
Methods
CreateLogger(string)
Creates an ILogger for the specified category. If a logger factory has been configured, it is used to create the logger; otherwise, a NullLogger is returned as a fallback.
public static ILogger CreateLogger(string category)
Parameters
categorystringThe category name for the logger to create.
Returns
- ILogger
An ILogger instance for the specified category, or a NullLogger when no logger factory is available.
CreateLogger<T>()
Creates an ILogger<TCategoryName> instance using the configured logger factory, or returns a NullLogger<T> instance when no factory has been set.
public static ILogger<T> CreateLogger<T>()
Returns
- ILogger<T>
An ILogger<TCategoryName> produced by the underlying ILoggerFactory if available; otherwise, a shared NullLogger<T> instance used as a no-op fallback.
Type Parameters
T
SetLogProvider(ILoggerFactory)
Sets the current log provider based on logger factory.
public static void SetLogProvider(ILoggerFactory loggerFactory)
Parameters
loggerFactoryILoggerFactoryThe logger factory.