package com.vungle.ads.internal.util; import android.util.Log; import java.util.regex.Pattern; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.text.Regex; /* loaded from: classes4.dex */ public final class Logger { public static final Companion Companion = new Companion(null); private static boolean enabled; public static final int d(String str, String str2) { return Companion.d(str, str2); } public static final int e(String str, String str2) { return Companion.e(str, str2); } public static final int e(String str, String str2, Throwable th) { return Companion.e(str, str2, th); } public static final int i(String str, String str2) { return Companion.i(str, str2); } public static final int i(String str, String str2, Throwable th) { return Companion.i(str, str2, th); } public static final int w(String str, String str2) { return Companion.w(str, str2); } public static final int w(String str, String str2, Throwable th) { return Companion.w(str, str2, th); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } public final void enable(boolean z) { Logger.enabled = z; } public final int d(String tag, String message) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); if (Logger.enabled) { return Log.d(tag, eraseSensitiveData(message)); } return -1; } public final int e(String tag, String message) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); if (Logger.enabled) { return Log.e(tag, eraseSensitiveData(message)); } return -1; } public final int e(String tag, String message, Throwable throwable) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); Intrinsics.checkNotNullParameter(throwable, "throwable"); if (!Logger.enabled) { return -1; } return Log.e(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage()); } public final int w(String tag, String message) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); if (Logger.enabled) { return Log.w(tag, eraseSensitiveData(message)); } return -1; } public final int w(String tag, String message, Throwable throwable) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); Intrinsics.checkNotNullParameter(throwable, "throwable"); if (!Logger.enabled) { return -1; } return Log.w(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage()); } public final int i(String tag, String message) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); if (Logger.enabled) { return Log.i(tag, eraseSensitiveData(message)); } return -1; } public final int i(String tag, String message, Throwable throwable) { Intrinsics.checkNotNullParameter(tag, "tag"); Intrinsics.checkNotNullParameter(message, "message"); Intrinsics.checkNotNullParameter(throwable, "throwable"); if (!Logger.enabled) { return -1; } return Log.i(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage()); } public final String eraseSensitiveData(String str) { Intrinsics.checkNotNullParameter(str, ""); Pattern compile = Pattern.compile("[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}"); Intrinsics.checkNotNullExpressionValue(compile, "compile(\"[\\\\d]{1,3}\\\\.[\\…[\\\\d]{1,3}\\\\.[\\\\d]{1,3}\")"); return new Regex(compile).replace(str, "xxx.xxx.xxx.xxx"); } } }