Interface IReportLogger
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
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
levelReportLevelThe message level.
categorystringThe category name.
messagestringAn optional message string for the data.
dataobjectThe message data object (can also be a
nullreference).metaInfosIDictionary<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
levelReportLevelThe message level.
categorystringThe category name.
messagestringThe message text.
escapeboolText escaping flag.
metaInfosIDictionary<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.