Table of Contents

Interface IReportLogger

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

An interface which has to be implemented for custom loggers.

public interface IReportLogger

Remarks

A custom logger stores log messages and data in a custom data store in a custom format.

Properties

PreFilterMessages

Determines whether the logger is called for all log message or only for messages whose report level is greater or equal than the currently set report level.

bool PreFilterMessages { get; }

Property Value

bool

Methods

End()

Ends logging. Should free all resources.

void End()

Remarks

The Report class calls this method when the logger should be closed. Close the log file or the database connection in this method.

LogData(ReportLevel, string, string, object, IDictionary<string, string>)

Logs a data message.

void LogData(ReportLevel level, string category, string message, object data, IDictionary<string, string> metaInfos)

Parameters

level ReportLevel

The message level.

category string

The category name.

message string

An optional message string for the data.

data object

The message data object (can also be a null reference).

metaInfos IDictionary<string, string>

Advanced reference information for use in the report.

Remarks

The Report class calls this method for each attached IReportLogger instance when the LogData(ReportLevel, string, object) method is called. The logger should store the method arguments in the data store.

You should handle all the data types you will pass to the LogData(ReportLevel, string, object) method in that method. By default, Ranorex uses this method to store screenshot and snapshot data in a report, so make sure that you handle data of type Bitmap and ElementSnapshot. Additionally, the Report.Link method passes a Uri object to that method that can be used to add a link to the report.

LogText(ReportLevel, string, string, bool, IDictionary<string, string>)

Logs a text message.

void LogText(ReportLevel level, string category, string message, bool escape, IDictionary<string, string> metaInfos)

Parameters

level ReportLevel

The message level.

category string

The category name.

message string

The message text.

escape bool

Text escaping flag.

metaInfos IDictionary<string, string>

Advanced reference information for use in the report.

Remarks

The Report class calls this method for each attached IReportLogger instance when the Log(ReportLevel, string) method is called. The logger should store the method arguments in the data store.

Start()

Starts the logger.

void Start()

Remarks

The Report class calls this method when the logger should be started. Open a file or a database connection in this method.