Logging API
Levels
LogLevel.Debug // 0
LogLevel.Info // 1
LogLevel.Warning // 2
LogLevel.Error // 3
LogLevel.Assert // 4
Methods
Log.Debug("message");
Log.Info("message");
Log.Warn("message");
Log.Error("message"); // logs + throws AssertionException
Log.Error("message", throwException: false); // logs only
Log.Error<InvalidOperationException>("message"); // throws custom exception type
Log.Assert(condition, "message"); // throws if condition is false
Log.Assert(condition, "message", throwException: false); // logs only, no throw
Log.Assert<InvalidOperationException>(condition, "msg"); // throws custom type on failure
All methods capture the caller's file path and line number automatically via [CallerFilePath] and [CallerLineNumber].
Return value
Every call returns a LogMessage:
LogMessage msg = Log.Info("Hello");
Debug.Log(msg.Created); // DateTime (local)
Debug.Log(msg.Level); // LogLevel
Debug.Log(msg.Message); // object?
Debug.Log(msg.File); // caller source path
Debug.Log(msg.Line); // caller line number
Debug.Log(msg.StackTrace); // StackTrace?
For Log.Assert, the return is LogMessage? - null when the assertion passes.
Thread safety
Logix is fully thread-safe. You can log from background threads, async callbacks, or jobs:
await Task.Delay(500);
Log.Info("From a background thread");
Global hook
Subscribe to all log messages (after filtering, before sinks):
LogContainer.OnLog += msg =>
Debug.Log($"{msg.Level}: {msg.Message}");
Viewing output
- Editor -> open the Logix Editor Window via
Tools -> Logix -> Show Window - Builds -> use the Runtime Console component (toggle with F12)