Class Diagnostics
Contains mostly static functions for diagnostic purposes.
Inheritance
Inherited Members
Namespace: Fusee.Base.Core
Assembly: Fusee.Base.Core.dll
Syntax
public static class Diagnostics
Properties
Timer
High precision timer values.
Declaration
public static double Timer { get; }
Property Value
Type | Description |
---|---|
System.Double | A double value containing consecutive real time values in milliseconds. |
Remarks
To measure the elapsed time between two places in code get this value twice and calculate the difference.
Methods
Debug(Object, Exception, Object[], String, Int32, String)
Log a debug event. Per default visible within the Visual Studio debug console and the console window in debug builds.
Declaration
[Conditional("DEBUG")]
public static void Debug(object o, Exception ex = null, object[] args = null, string callerName = "", int sourceLineNumber = 0, string sourceFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to write |
System.Exception | ex | A possible exception, optional |
System.Object[] | args | Possible arguments, optional |
System.String | callerName | The calling method |
System.Int32 | sourceLineNumber | The line number, optional. |
System.String | sourceFilePath | The file path, optional. |
Error(Object, Exception, Object[], String, Int32, String)
Log an error event. Per default visible within the Visual Studio debug console and the console window in debug and release builds.
Declaration
public static void Error(object o, Exception ex = null, object[] args = null, string callerName = "", int sourceLineNumber = 0, string sourceFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to write |
System.Exception | ex | A possible exception, optional |
System.Object[] | args | Possible arguments, optional |
System.String | callerName | The calling method |
System.Int32 | sourceLineNumber | The line number, optional. |
System.String | sourceFilePath | The file path, optional. |
Info(Object, Exception, Object[], String, Int32, String)
Log a info event. Per default visible within the Visual Studio debug console and the console window in debug builds, as well as in release builds.
Declaration
public static void Info(object o, Exception ex = null, object[] args = null, string callerName = "", int sourceLineNumber = 0, string sourceFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to write |
System.Exception | ex | A possible exception, optional |
System.Object[] | args | Possible arguments, optional |
System.String | callerName | The calling method |
System.Int32 | sourceLineNumber | The line number, optional. |
System.String | sourceFilePath | The file path, optional. |
LogToTextFile(Boolean, String)
Enable / disable text file logging, default is disabled
Declaration
public static void LogToTextFile(bool logToTxtFile, string logFileName = "")
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | logToTxtFile | |
System.String | logFileName |
SetFormat(Diagnostics.Formater)
Update the format of the logging messages
Declaration
public static void SetFormat(Diagnostics.Formater formater)
Parameters
Type | Name | Description |
---|---|---|
Diagnostics.Formater | formater |
SetMinConsoleLoggingSeverityLevel(Diagnostics.SeverityLevel)
Change the min logging severity level before logging is written to the console
Declaration
public static void SetMinConsoleLoggingSeverityLevel(Diagnostics.SeverityLevel lvl)
Parameters
Type | Name | Description |
---|---|---|
Diagnostics.SeverityLevel | lvl |
SetMinDebugOutputLoggingSeverityLevel(Diagnostics.SeverityLevel)
Change the min logging severity level before logging is written to the debug output
Declaration
public static void SetMinDebugOutputLoggingSeverityLevel(Diagnostics.SeverityLevel lvl)
Parameters
Type | Name | Description |
---|---|---|
Diagnostics.SeverityLevel | lvl |
SetMinTextFileLoggingSeverityLevel(Diagnostics.SeverityLevel)
Change the min logging severity level before logging is placed within the log text file
Declaration
public static void SetMinTextFileLoggingSeverityLevel(Diagnostics.SeverityLevel lvl)
Parameters
Type | Name | Description |
---|---|---|
Diagnostics.SeverityLevel | lvl |
UseConsoleColor(Boolean)
Set the logger to utilize colored console output Can be disabled for platform which do not support colored console output, e. g. Blazor
Declaration
public static void UseConsoleColor(bool use)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | use |
Verbose(Object, Exception, Object[], String, Int32, String)
Log a debug event. Per default visible within the Visual Studio debug console and the console window in debug builds.
Declaration
[Conditional("DEBUG")]
public static void Verbose(object o, Exception ex = null, object[] args = null, string callerName = "", int sourceLineNumber = 0, string sourceFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to write |
System.Exception | ex | A possible exception, optional |
System.Object[] | args | Possible arguments, optional |
System.String | callerName | The calling method |
System.Int32 | sourceLineNumber | The line number, optional. |
System.String | sourceFilePath | The file path, optional. |
Warn(Object, Exception, Object[], String, Int32, String)
Log a warning event. Per default visible within the Visual Studio debug console and the console window in debug builds.
Declaration
public static void Warn(object o, Exception ex = null, object[] args = null, string callerName = "", int sourceLineNumber = 0, string sourceFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to write |
System.Exception | ex | A possible exception, optional |
System.Object[] | args | Possible arguments, optional |
System.String | callerName | The calling method |
System.Int32 | sourceLineNumber | The line number, optional. |
System.String | sourceFilePath | The file path, optional. |