Class GraphicsTestLogger
A logger for the graphics tests. This class is used to log messages to a file.
The default log file is created as Logs/GraphicsTestLogs.log in the project's root directory.
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
[InitializeOnLoad]
public static class GraphicsTestLogger
Fields
MostRecentLogPath
The most recent log path used by the test logger.
Declaration
public static string MostRecentLogPath
Field Value
| Type | Description |
|---|---|
| string |
Methods
DebugError(string)
Logs an error to the file. The message will appear in the console if debug mode is on.
Declaration
public static void DebugError(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
DebugException(Exception)
Logs an exception to the file. The message will appear in the console if debug mode is on.
Declaration
public static void DebugException(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to log. |
DebugLog(string)
Logs a message to the file. The message will appear in the console if debug mode is on.
Declaration
public static void DebugLog(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
DebugWarning(string)
Logs a warning to the file. The message will appear in the console if debug mode is on.
Declaration
public static void DebugWarning(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
Log(string, bool)
Logs a message. The message is written to the buffer, log file and/or console, depending on settings.
Declaration
public static void Log(string message, bool logToConsole = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
| bool | logToConsole | Whether to log the message to the Unity console. If this is false, the message is only logged to the file. |
Remarks
This method logs a message to the log file and the Unity console. The message is prefixed with a timestamp and the type of message.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if the type is not a valid LogType. |
Log(LogType, string, string, bool)
Logs a message. The message is written to the buffer, log file and/or console, depending on settings.
Declaration
public static void Log(LogType type, string message, string logPath = "Logs/GraphicsTestLogs.log", bool logToConsole = true)
Parameters
| Type | Name | Description |
|---|---|---|
| LogType | type | The type of message to log. This can be LogType.Error, LogType.Warning, or LogType.Log. |
| string | message | The message to log. |
| string | logPath | The path to the log file. If this is null or empty, the default log path is used. |
| bool | logToConsole | Whether to log the message to the Unity console. If this is false, the message is only logged to the file. |
Remarks
This method logs a message to the log file and the Unity console. The message is prefixed with a timestamp and the type of message.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if the type is not a valid LogType. |
LogError(string, string, bool)
Logs an error.
Declaration
public static void LogError(string message, string logPath = "Logs/GraphicsTestLogs.log", bool logToConsole = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to be logged. |
| string | logPath | The path to the log file. If this is null or empty, the default log path is used. |
| bool | logToConsole | Whether to log the message to the Unity console. If this is false, the message is only logged to the file. |
LogException(Exception, string, bool)
Logs an exception.
Declaration
public static void LogException(Exception exception, string logPath = "Logs/GraphicsTestLogs.log", bool logToConsole = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to be logged. |
| string | logPath | The path to the log file. If this is null or empty, the default log path is used. |
| bool | logToConsole | Whether to log the exception to the Unity console. If this is false, the message is only logged to the file. |
LogWarning(string, string, bool)
Logs a warning.
Declaration
public static void LogWarning(string message, string logPath = "Logs/GraphicsTestLogs.log", bool logToConsole = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to be logged. |
| string | logPath | The path to the log file. If this is null or empty, the default log path is used. |
| bool | logToConsole | Whether to log the message to the Unity console. If this is false, the message is only logged to the file. |