package com.google.android.gms.internal.ads;

import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.Size;
import java.net.UnknownHostException;
import org.checkerframework.dataflow.qual.Pure;

/* JADX INFO: loaded from: classes2.dex */
public abstract class vt0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final Object f17768a = new Object();

    public static void a(String str) {
        synchronized (f17768a) {
            zzg(str, null);
        }
    }

    public static void b(String str) {
        synchronized (f17768a) {
            zzg(str, null);
        }
    }

    public static void c(String str) {
        synchronized (f17768a) {
            zzg(str, null);
        }
    }

    public static void d(String str) {
        synchronized (f17768a) {
            zzg(str, null);
        }
    }

    @Pure
    public static void zzd(@Size(max = 23) String str, String str2, @Nullable Throwable th) {
        synchronized (f17768a) {
            zzg(str2, th);
        }
    }

    @Pure
    public static void zzf(@Size(max = 23) String str, String str2, @Nullable Throwable th) {
        synchronized (f17768a) {
            zzg(str2, th);
        }
    }

    @Pure
    public static String zzg(String str, @Nullable Throwable th) {
        String strReplace;
        if (th != null) {
            synchronized (f17768a) {
                Throwable cause = th;
                while (true) {
                    if (cause == null) {
                        strReplace = Log.getStackTraceString(th).trim().replace("\t", "    ");
                        break;
                    }
                    try {
                        if (cause instanceof UnknownHostException) {
                            strReplace = "UnknownHostException (no network)";
                        } else {
                            cause = cause.getCause();
                        }
                    } finally {
                    }
                }
            }
        } else {
            strReplace = null;
        }
        if (TextUtils.isEmpty(strReplace)) {
            return str;
        }
        String strReplace2 = strReplace.replace("\n", "\n  ");
        int length = String.valueOf(str).length();
        return com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.h(new StringBuilder(String.valueOf(strReplace2).length() + length + 3 + 1), str, "\n  ", strReplace2, "\n");
    }
}
