Skip to content

7. Logging

Joni Savolainen edited this page Oct 23, 2022 · 2 revisions

By default, UIComponents use Debug.Log to log messages. This can be changed by overriding the ILogger dependency.

public class MyLogger : ILogger
{
    public void Log(string message, object caller)
    {
        // Do something with the message
    }
    
    public void LogWarning(string message, object caller)
    {
        // Do something with the message
    }
    
    public void LogError(string message, object caller)
    {
        // Do something with the message
    }
}

[Dependency(typeof(ILogger), provide: typeof(MyLogger))]
public class MyComponent : UIComponent {}
Clone this wiki locally