package c.i.a.c.i2; import android.text.TextUtils; import android.util.Log; import androidx.annotation.Nullable; import c.d.b.a.a; import java.net.UnknownHostException; import org.checkerframework.dataflow.qual.Pure; /* compiled from: Log */ public final class p { @Pure public static String a(String str, @Nullable Throwable th) { String str2; boolean z2; if (th == null) { str2 = null; } else { Throwable th2 = th; while (true) { if (th2 == null) { z2 = false; break; } else if (th2 instanceof UnknownHostException) { z2 = true; break; } else { th2 = th2.getCause(); } } str2 = z2 ? "UnknownHostException (no network)" : Log.getStackTraceString(th).trim().replace("\t", " "); } if (TextUtils.isEmpty(str2)) { return str; } StringBuilder O = a.O(str, "\n "); O.append(str2.replace("\n", "\n ")); O.append('\n'); return O.toString(); } @Pure public static void b(String str, String str2, @Nullable Throwable th) { Log.e(str, a(str2, th)); } @Pure public static void c(String str, String str2, @Nullable Throwable th) { Log.w(str, a(str2, th)); } }