package com.byted.mgl.exp.h5game.util;

import X.M12;
import com.bytedance.covode.number.Covode;
import kotlin.h.b.n;
import kotlin.o.y;

public final class MglLog {
    public static final MglLog INSTANCE = new MglLog();
    public static volatile boolean sLogged = true;

    public final boolean getSLogged() {
        return sLogged;
    }

    static {
        Covode.recordClassIndex(3905);
    }

    public final void setSLogged(boolean z) {
        sLogged = z;
    }

    private final String formatTag(String str) {
        if (str == null) {
            return "mgl";
        }
        if (!y.LIZIZ(str, "mgl_", false)) {
            return "mgl_".concat(String.valueOf(str));
        }
        return str;
    }

    private final String createLog(Object... objArr) {
        if (objArr.length == 0) {
            return "empty_log";
        }
        int i = -1;
        StringBuilder sb = new StringBuilder();
        String str = "unknown file";
        String str2 = "unknown";
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        if (stackTrace.length > 2) {
            StackTraceElement stackTraceElement = stackTrace[2];
            n.LIZ(stackTraceElement, "");
            String fileName = stackTraceElement.getFileName();
            if (fileName != null) {
                str = fileName;
            }
            StackTraceElement stackTraceElement2 = stackTrace[2];
            n.LIZ(stackTraceElement2, "");
            String methodName = stackTraceElement2.getMethodName();
            if (methodName != null) {
                str2 = methodName;
            }
            StackTraceElement stackTraceElement3 = stackTrace[2];
            n.LIZ(stackTraceElement3, "");
            i = stackTraceElement3.getLineNumber();
        }
        sb.append(str2);
        sb.append('(');
        sb.append(str);
        StringBuilder sb2 = sb;
        sb2.append(':');
        sb2.append(i);
        sb2.append(") ");
        for (Object obj : objArr) {
            sb.append(' ');
            if (obj != null) {
                sb.append(obj);
            } else {
                sb.append("null");
            }
        }
        String sb3 = sb.toString();
        n.LIZ(sb3, "");
        return sb3;
    }

    public final void d(String str, Object... objArr) {
        M12.LIZ(str, objArr);
        boolean z = sLogged;
    }

    public final void e(String str, Object... objArr) {
        M12.LIZ(str, objArr);
        boolean z = sLogged;
    }

    public final void i(String str, Object... objArr) {
        M12.LIZ(str, objArr);
        boolean z = sLogged;
    }

    public final void w(String str, Object... objArr) {
        M12.LIZ(str, objArr);
        boolean z = sLogged;
    }

    public final void eWithThrowable(String str, String str2, Throwable th) {
        M12.LIZ(str, th);
        boolean z = sLogged;
    }
}
