Class QueuedLogger
A thread-safe logging system that queues log messages and supports deduplication of identical messages. Messages are batched and flushed to Unity's Debug system periodically.
Inherited Members
Namespace: QuestNav.Utils
Assembly: QuestNav.dll
Syntax
public static class QueuedLogger
Methods
Flush()
Flushes all queued messages in order using the appropriate Debug method, and then clears the queue.
Declaration
public static void Flush()
Log(string, LogLevel, string)
Queues a message with the given log level. If the message is identical (and has no associated exception) to the previous entry, its count is increased.
Declaration
public static void Log(string message, QueuedLogger.LogLevel level = LogLevel.Info, string callerFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log |
QueuedLogger.LogLevel | level | The log level (defaults to Info) |
string | callerFilePath | Automatically populated with the calling file path |
LogError(string, string)
Queues an error message.
Declaration
public static void LogError(string message, string callerFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
string | message | The error message to log |
string | callerFilePath | Automatically populated with the calling file path |
LogException(Exception, string)
Queues an exception log entry using the exception's message.
Declaration
public static void LogException(Exception exception, string callerFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception to log |
string | callerFilePath | Automatically populated with the calling file path |
LogException(string, Exception, string)
Queues an exception log entry with a custom message and exception details.
Declaration
public static void LogException(string message, Exception exception, string callerFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
string | message | Custom message to accompany the exception |
Exception | exception | The exception to log |
string | callerFilePath | Automatically populated with the calling file path |
LogWarning(string, string)
Queues a warning message.
Declaration
public static void LogWarning(string message, string callerFilePath = "")
Parameters
Type | Name | Description |
---|---|---|
string | message | The warning message to log |
string | callerFilePath | Automatically populated with the calling file path |