Class Log
Provides context aware logging functionality for the Selenium WebDriver.
public static class Log
- Inheritance
-
Log
- Inherited Members
Remarks
Use the following code to enable logging to console:
Log.SetMinimumLevel(LogEventLevel.Debug)).WithHandler(new ConsoleLogHandler());
Or enable it per limited execution scope:
using (var ctx = Log.CreateContext(LogEventLevel.Trace))
{
// do something
}
Properties
CurrentContext
Gets or sets the current log context.
public static ILogContext CurrentContext { get; set; }
Property Value
Handlers
Gets a list of log handlers for the current log context.
public static ILogHandlerList Handlers { get; }
Property Value
Methods
CreateContext()
Creates a new log context with the current context properties and the specified minimum log event level.
public static ILogContext CreateContext()
Returns
- ILogContext
The created log context.
CreateContext(LogEventLevel)
Creates a new log context with with the current context properties and the specified minimum log event level.
public static ILogContext CreateContext(LogEventLevel minimumLevel)
Parameters
minimumLevelLogEventLevelThe minimum log event level.
Returns
- ILogContext
The created log context.
GetLogger(Type)
Gets a logger for the specified type.
public static ILogger GetLogger(Type type)
Parameters
typeTypeThe type to get the logger for.
Returns
- ILogger
The logger.
GetLogger<T>()
Gets a logger for the specified type.
public static ILogger GetLogger<T>()
Returns
- ILogger
The logger.
Type Parameters
TThe type to get the logger for.
SetLevel(LogEventLevel)
Sets the minimum log event level for the current log context.
public static ILogContext SetLevel(LogEventLevel level)
Parameters
levelLogEventLevelThe minimum log event level.
Returns
- ILogContext
The current log context.
SetLevel(Type, LogEventLevel)
Sets the minimum log event level for the specified issuer in the current log context.
public static ILogContext SetLevel(Type issuer, LogEventLevel level)
Parameters
issuerTypeThe issuer type.
levelLogEventLevelThe minimum log event level.
Returns
- ILogContext
The current log context.