Class Log
Lightweight, host-agnostic logger.
- Works in plain .NET via Console/Debug.
- Detects Unity at runtime via reflection and forwards to UnityEngine.Debug.
- Exposes a pluggable sink/event so hosts can capture logs.
Inheritance
object
Log
Namespace: Wss.CoreModule
Assembly: WSS_Core_Interface.dll
Syntax
public static class Log
Methods
Error(Exception, string)
Writes an exception as an error message.
Declaration
public static void Error(Exception ex, string prefix = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | ex | Exception to log. |
| string | prefix | Optional prefix to prepend to the exception string. |
Error(string)
Writes an error message.
Declaration
public static void Error(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message |
Info(string)
Writes an informational message.
Declaration
public static void Info(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message |
ResetSink()
Reset to the default behavior (Unity if present, otherwise Console/Debug).
Declaration
public static void ResetSink()
SetSink(Action<LogLevel, string>)
Replace the log sink with a custom receiver (e.g., Unity adapter or Python callback).
Declaration
public static void SetSink(Action<Log.LogLevel, string> sink)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<Log.LogLevel, string> | sink |
Warn(string)
Writes a warning message.
Declaration
public static void Warn(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message |
Events
Message
Raised for each message written via this logger, after the sink is invoked.
Declaration
public static event Action<Log.LogLevel, string> Message
Event Type
| Type | Description |
|---|---|
| Action<Log.LogLevel, string> |