package com.tencent.api;

import android.util.Log;

/* JADX INFO: loaded from: classes.dex */
public class TEANativeInsideLog {
    public static final int LEVEL_DEBUG = 1;
    public static final int LEVEL_ERROR = 4;
    public static final int LEVEL_INFO = 2;
    public static final int LEVEL_VERBOSE = 0;
    public static final int LEVEL_WARN = 3;
    private static final String TAG = "TeaInside";
    private static ITEANativeInsideLogCb mLogCallback;

    @TEAMethodCalledByNative
    private static void onPrintLog(byte[] bArr, int i2) {
        try {
            printLog(2, TAG, new String(bArr, 0, i2, "UTF-8"));
        } catch (Exception e2) {
            printLog(4, TAG, e2.getMessage());
        }
    }

    public static void printLog(int i2, String str, String str2) {
        ITEANativeInsideLogCb iTEANativeInsideLogCb = mLogCallback;
        if (iTEANativeInsideLogCb != null) {
            iTEANativeInsideLogCb.onPrintLog(str2);
        }
    }

    public static void printLogDefault(int i2, String str, String str2) {
        if (i2 == 1) {
            Log.d(str, str2);
            return;
        }
        if (i2 == 2) {
            Log.i(str, str2);
            return;
        }
        if (i2 == 3) {
            Log.w(str, str2);
        } else if (i2 != 4) {
            Log.v(str, str2);
        } else {
            Log.e(str, str2);
        }
    }

    public static void registerLogCb(ITEANativeInsideLogCb iTEANativeInsideLogCb) {
        mLogCallback = iTEANativeInsideLogCb;
    }
}
