package tv.twitch.twiglib;

import com.unity3d.player.*;

public class Logger {
    private static final String TAG = "Twitch";

    private static String gameObjectName;
    private static String methodName;

    public static void SetReceiver(String gameObjectName, String methodName){
        Logger.gameObjectName = gameObjectName;
        Logger.methodName = methodName;
    }

    public static void e(String message){
        e(TAG, message);
    }

    public static void e(String tag, String message){
        Logger.d(tag, "!ERROR " + message);
    }

    public static void d(String message){
        d(TAG, message);
    }

    public static void d(String tag, String message){
        if(gameObjectName == null || gameObjectName.isEmpty() || methodName == null || methodName.isEmpty())
            return;
        UnityPlayer.UnitySendMessage(gameObjectName, methodName, tag + ": " + message);
    }
}
