Class StaticApplicationLogging
Provides static access to application logging functionality.
Inheritance
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
public static class StaticApplicationLogging
Remarks
This class provides a way to access logging before dependency injection is fully configured. It must be initialized with an Microsoft.Extensions.Logging.ILoggerFactory before use.
Properties
View SourceLogger
Gets a default logger instance for general logging purposes.
Declaration
public static ILogger<object> Logger { get; }
Property Value
| Type | Description |
|---|---|
| ILogger<object> |
Methods
View SourceCreateLogger(Type)
Creates a logger for the specified type.
Declaration
public static ILogger CreateLogger(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to create a logger for. |
Returns
| Type | Description |
|---|---|
| ILogger | An Microsoft.Extensions.Logging.ILogger instance, or a null logger if not initialized. |
CreateLogger<T>()
Creates a logger for the specified type.
Declaration
public static ILogger<T> CreateLogger<T>()
Returns
| Type | Description |
|---|---|
| ILogger<T> | An Microsoft.Extensions.Logging.ILogger<TCategoryName> instance, or a null logger if not initialized. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to create a logger for. |
Initialize(ILoggerFactory)
Initializes the static logging with the specified logger factory.
Declaration
public static void Initialize(ILoggerFactory loggerFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| ILoggerFactory | loggerFactory | The Microsoft.Extensions.Logging.ILoggerFactory to use for creating loggers. |