Table of Contents

Class Log

Namespace
OpenQA.Selenium.Internal.Logging
Assembly
WebDriver.dll

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

Handlers

Gets a list of log handlers for the current log context.

public static ILogHandlerList Handlers { get; }

Property Value

ILogHandlerList

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

minimumLevel LogEventLevel

The minimum log event level.

Returns

ILogContext

The created log context.

SetLevel(LogEventLevel)

Sets the minimum log event level for the current log context.

public static ILogContext SetLevel(LogEventLevel level)

Parameters

level LogEventLevel

The 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

issuer Type

The issuer type.

level LogEventLevel

The minimum log event level.

Returns

ILogContext

The current log context.