package com.tapjoy; import android.os.Handler; import android.os.Looper; import android.util.Log; import com.tapjoy.TapjoyErrorMessage; /* loaded from: classes4.dex */ public class TapjoyLog { public static boolean a = false; public static int b = 6; public static void a(String str, boolean z) { if (!z && TapjoyAppSettings.getInstance() != null && TapjoyAppSettings.getInstance().b != null) { d("TapjoyLog", "setLoggingLevel -- log setting already persisted"); return; } if (str.equals(TapjoyConstants.LOG_LEVEL_INTERNAL)) { b = 2; new Handler(Looper.getMainLooper()).post(new o1()); } else if (str.equals(TapjoyConstants.LOG_LEVEL_DEBUG_ON)) { b = 4; } else if (str.equals(TapjoyConstants.LOG_LEVEL_DEBUG_OFF)) { b = 6; } else { d("TapjoyLog", "unrecognized loggingLevel: ".concat(str)); b = 6; } d("TapjoyLog", "logThreshold=" + b); } public static void d(String str, String str2) { a(3, str, str2); } public static void e(String str, String str2) { e(str, new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTERNAL_ERROR, str2)); } public static void i(String str, String str2) { a(4, str, str2); } public static boolean isLoggingEnabled() { return a; } public static void setInternalLogging(boolean z) { if (z) { a(TapjoyConstants.LOG_LEVEL_INTERNAL, true); } } public static void v(String str, String str2) { a(2, str, str2); } public static void w(String str, String str2) { a(5, str, str2); } public static void e(String str, TapjoyErrorMessage tapjoyErrorMessage) { if (tapjoyErrorMessage != null) { if (b == 2 || tapjoyErrorMessage.getType() != TapjoyErrorMessage.ErrorType.INTERNAL_ERROR) { a(6, str, tapjoyErrorMessage.toString()); } } } public static void setDebugEnabled(boolean z) { a = z; if (z) { a(TapjoyConstants.LOG_LEVEL_DEBUG_ON, false); } else { a(TapjoyConstants.LOG_LEVEL_DEBUG_OFF, false); } } public static void a(int i, String str, String str2) { String str3 = "TapjoyLog:" + str; if (b <= i) { if (str2.length() > 4096) { int i2 = 0; while (i2 <= str2.length() / 4096) { int i3 = i2 * 4096; i2++; int i4 = i2 * 4096; if (i4 > str2.length()) { i4 = str2.length(); } Log.println(i, str3, str2.substring(i3, i4)); } return; } Log.println(i, str3, str2); } } }