The Kanda SDK provides a custom logging implementation, KandaLog, which wraps the Unity Logging package. This custom logger includes standardized tags and additional contextual information, ensuring consistency across all logs generated by the Kanda SDK.
Introduction
KandaLog is designed to replace the typical UnityEngine.Debug.Log method. By using KandaLog, developers can produce logs that are easier to parse and understand, especially when debugging or reviewing logs from live applications.
Key Methods
Write
Logs a simple message with the default LogType.Log.
KandaLog.Write("Application started successfully.");
Write with Logging Severity
Logs a message with a specified logging severity (e.g., LogType.Warning, LogType.Error).
KandaLog.Write("A transition to session scene was requested, but this is already the active scene.", LogType.Warning);
Write with World Context
Logs a message with additional context about the ECS world.
KandaLog.Write("Loading initial game state.", world);
WriteSendRpc
Logs a message indicating that an RPC (Remote Procedure Call) is being sent.
KandaLog.WriteSendRpc("to request player data.", world);
WriteHandleRpc
Logs a message indicating that an RPC is being handled.
KandaLog.WriteHandleRpc("to update player status.", world);
Log Output Examples
Logs in the Unity Console will appear as follows:
Kanda SDK: Application started successfully.
Kanda SDK: A transition to session scene was requested, but this is already the active scene.
Kanda SDK: (Client World) Loading initial game state.
Kanda SDK: (Client World) Sending RPC to request player data.
Kanda SDK: (Server World) Handling RPC to update player status.
Unity Console Tips
- Strip logging callstack: Enable this to prevent the logger class from appearing at the top of all logs.
- Log entry: Set to "1 line" for a more compact and easy-to-read log.
- Show timestamp: Typically disable this for cleaner logs, but enable temporarily if timing information is relevant.
- Use Monospace font: Enable for good looks...