Class LogManager
NOTE: This is a pre-release API that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version. Class responsible for creating new ILogger instances.
Inheritance
Inherited Members
Namespace: EPiServer.Logging
Assembly: EPiServer.Framework.dll
Version: 8.11.0Syntax
public class LogManager
Constructors
LogManager()
Initializes a new instance of the LogManager class.
Declaration
public LogManager()
Fields
BoundaryType
Gets the type of the class that represents the boundary of the logging system.
Declaration
public static readonly Type BoundaryType
Field Value
Type | Description |
---|---|
System.Type |
Remarks
This can be used by certain logging framework to find and log the correct stack information.
Properties
Instance
Gets or sets the current LogManager instance.
Declaration
public static LogManager Instance { get; set; }
Property Value
Type | Description |
---|---|
LogManager |
Remarks
This property is guaranteed to always return a LogManager object. If set to null, all logging will be cancelled.
Methods
AddFactory(ILoggerFactory)
Adds a ILoggerFactory to the current LogManager.
Declaration
public virtual void AddFactory(ILoggerFactory factory)
Parameters
Type | Name | Description |
---|---|---|
ILoggerFactory | factory | The factory that should be used. |
Remarks
The basic LogManager implementation currently only supports the use of one single ILoggerFactory and will only use the instance last registered. This behavior is subject to change in future releases.
Adding a new factory will not affect any ILogger instances that has been created and used already.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | factory |
GetLogger()
Declaration
public static ILogger GetLogger()
Returns
Type | Description |
---|---|
ILogger | A new ILogger instance. |
Remarks
As this method uses the stack and some reflection it is not recommended to use this from other than initializing static fields.
GetLogger(String)
Gets a ILogger instance for the provided name.
Declaration
public virtual ILogger GetLogger(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the logger to get. |
Returns
Type | Description |
---|---|
ILogger | A new ILogger instance |
Remarks
This method is guaranteed to always return an instance.
GetLogger(Type)
Declaration
public static ILogger GetLogger(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type that the logger should be created for. |
Returns
Type | Description |
---|---|
ILogger | A new ILogger instance. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | type |