Class Output
This class is in charge of writing the output into the terminal.
Inheritance
Namespace: AutoCheck.Core
Assembly: AutoCheck.Core.dll
Syntax
public class Output : object
Remarks
Should be a singletone but cannot be due testing...
Constructors
| Improve this Doc View SourceOutput()
Creates the new Output instance
Declaration
public Output()
Output(Boolean)
Creates the new Output instance
Declaration
public Output(bool redirectToTerminal = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | redirectToTerminal | When enabled, every log entry will be send to the terminal |
Fields
| Improve this Doc View SourceSingleIndent
Declaration
public const string SingleIndent = null
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceCurrentIndent
Declaration
public string CurrentIndent { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceBreakLine(Int32)
Writes a set of breakline into the output.
Declaration
public void BreakLine(int lines = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | lines | The amount of breaklines. |
CloseLog()
The current log will be closed, so a new empty one will be ready to start logging again.
Declaration
public Output.Log CloseLog()
Returns
Type | Description |
---|---|
Output.Log | The closed log |
GetLog()
Returns the complete log files for each batch (or single) execution (header + setup + script + teardown).
Declaration
public Output.Log[] GetLog()
Returns
Type | Description |
---|---|
Output.Log[] |
Indent()
Adds an indentation (3 whitespaces) to the output.
Declaration
public void Indent()
ResetIndent()
Resets the output indentation.
Declaration
public void ResetIndent()
SendToTerminal(Output.Log)
Sends the given log to the terminal.
Declaration
public void SendToTerminal(Output.Log log)
Parameters
Type | Name | Description |
---|---|---|
Output.Log | log | The log to print. |
ToJson()
Returns the Output history as an string, using \r\n as breaklines.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String |
ToString()
Returns the Output history as an string, using \r\n as breaklines.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
System.String |
UnIndent()
Removes an indentation (3 whitespaces) from the output.
Declaration
public void UnIndent()
Write(String, Output.Style)
Send new text to the output, no breakline will be added to the end. The text will be printed in gray, and everything between '~' symbols will be printed using a secondary color (or till the last ':' or '...' symbols).
Declaration
public void Write(string text, Output.Style style = Output.Style.DEFAULT)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display |
Output.Style | style | Which stuyle will be applied in order to print using colors. |
WriteLine(String, Output.Style)
Send new text to the output, a breakline will be added to the end. The text will be printed in gray, and everything between '~' symbols will be printed using a secondary color (or till the last ':' or '...' symbols).
Declaration
public void WriteLine(string text, Output.Style style = Output.Style.DEFAULT)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display |
Output.Style | style | Which stuyle will be applied in order to print using colors. |
WriteResponse(List<String>, String, String)
Given a list of strings containing the errors found during a script execution (usually the return of a checker's method), the output will be as follows: 'OK' in green if the errors list is empty; 'ERROR' in red, followed by all the errors descriptions (as a list), otherwise.
Declaration
public void WriteResponse(List<string> errors = null, string captionOk = "OK", string captionError = "ERROR")
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | errors | A list of errors, usually the return of a checker's method. |
System.String | captionOk | |
System.String | captionError |
WriteResponse(String, String, String)
Given a string containing an error description, the output will be as follows: 'ERROR' in red, followed by the errors description if the error is not empty; just 'ERROR' in red otherwise.
Declaration
public void WriteResponse(string error, string captionOk = "OK", string captionError = "ERROR")
Parameters
Type | Name | Description |
---|---|---|
System.String | error | |
System.String | captionOk | |
System.String | captionError |
Events
| Improve this Doc View SourceOnLogUpdate
Declaration
public event EventHandler<LogUpdateEventArgs> OnLogUpdate
Event Type
Type | Description |
---|---|
EventHandler<LogUpdateEventArgs> |