Class Alert
AlertService - centralized info / warning / error alerting.
[Serializable]
public class Alert : IAlertService, IServiceBase
- Inheritance
-
Alert
- Implements
- Inherited Members
Constructors
Alert()
protected Alert()
Properties
ErrorTarget
Reads or sets the output target for Error Alerts. Defaults to OutputWindow and Datalog, which cannot be disabled.
public AlertOutputTarget ErrorTarget { get; set; }
Property Value
InfoTarget
Reads or sets the output target for Info Alerts. Defaults to OutputWindow, which cannot be disabled.
public AlertOutputTarget InfoTarget { get; set; }
Property Value
Instance
public static IAlertService Instance { get; }
Property Value
LogTarget
Reads or sets the output target for Log Alerts. Defaults to OutputWindow, which cannot be disabled.
public AlertOutputTarget LogTarget { get; set; }
Property Value
OutputFile
Reads or sets the file path for the output file.
public string OutputFile { get; set; }
Property Value
TimeStamp
Reads or sets whether a time stamp is added to Info / Warning and Error Alerts.
public bool TimeStamp { get; set; }
Property Value
WarningTarget
Reads or sets the output target for Warning Alerts. Defaults to OutputWindow and Datalog, which cannot be disabled.
public AlertOutputTarget WarningTarget { get; set; }
Property Value
Methods
Error(string, int, string)
Sends an Error Alert message to the selected output target(s). At test program runtime, this raises an exception to the IG-XL error handler. If called during validation, it fails validation and flags the error appropriately. Use this for non-recoverable conditions that require immediate and safe termination. Note: The compiler does not recognize that this method never returns, so you may need extra checks to satisfy .NET Framework requirements.
public void Error(string error, int validationArgumentIndex = 0, string doNotSpecify = "")
Parameters
errorstringThe Error Alert message.
validationArgumentIndexintOptional. The offending test instance argument index (one-based), if applicable when used in validation.
doNotSpecifystringDO NOT SPECIFY - the name of the calling method is automatically inserted by the compiler.
Error<TException>(string, int, string)
Sends an Error Alert message to the selected output target(s). At test program runtime, this raises a user-selectable exception to the IG-XL error handler. If called during validation, it fails validation and flags the error appropriately. Use this for non-recoverable conditions that require immediate and safe termination. Note: The compiler does not recognize that this method never returns, so you may need extra checks to satisfy .NET Framework requirements.
public void Error<TException>(string error, int validationArgumentIndex = 0, string doNotSpecify = "") where TException : Exception
Parameters
errorstringThe Error Alert message.
validationArgumentIndexintOptional. The offending test instance argument index (one-based), if applicable when used in validation.
doNotSpecifystringDO NOT SPECIFY - the name of the calling method is automatically inserted by the compiler.
Type Parameters
TExceptionThe type of the exception to be thrown.
Info(string, string)
Sends an Info Alert message to the selected output target(s). Use for positive / neutral information relevant to the user.
public void Info(string info, string doNotSpecify = "")
Parameters
infostringThe Info Alert message.
doNotSpecifystringDO NOT SPECIFY - the name of the calling method is automatically inserted by the compiler.
Log(string, byte, byte, byte, bool)
Sends a Log Alert message to the selected output target(s).
public void Log(string message, byte red, byte green, byte blue, bool bold = false)
Parameters
messagestringThe message string to be logged.
redbyteThe red component of a RGB color.
greenbyteThe green component of a RGB color.
bluebyteThe blue component of a RGB color.
boldboolOptional. Whether bold font is used (OutputWindow only, ignored elsewhere).
Log(string, ColorConstants, bool)
Sends a Log Alert message to the selected output target(s).
public void Log(string message, ColorConstants color = ColorConstants.Black, bool bold = false)
Parameters
messagestringThe message string to be logged.
colorColorConstantsOptional. The color to be used (OutputWindow only, ignored elsewhere).
boldboolOptional. Whether bold font is used (OutputWindow only, ignored elsewhere).
LogToFile(string, string)
Sends a Log message to the specified log file.
public void LogToFile(string logLabel, string message)
Parameters
Reset()
Initialize the service. This is called by the API when the service is first used.
public void Reset()
Warning(string, string)
Sends a Warning Alert message to the selected output target(s). Use for recoverable issues that may require attention.
public void Warning(string warning, string doNotSpecify = "")