package com.huawei.hms.base.log; import android.content.Context; import android.util.Log; /* loaded from: classes2.dex */ public class b { private String b; private int a = 4; private d c = new c(); private void b() { } public void b(int i, String str, String str2, Throwable th) { try { if (a(i)) { e a = a(i, str, str2, th); StringBuilder sb = new StringBuilder(); sb.append(a.c()); sb.append(a.a()); String obj = sb.toString(); d dVar = this.c; StringBuilder sb2 = new StringBuilder(); sb2.append(str2); sb2.append('\n'); sb2.append(Log.getStackTraceString(th)); dVar.a(obj, i, str, sb2.toString()); } } catch (OutOfMemoryError unused) { b(); } } public void a(Context context, int i, String str) { this.a = i; this.b = str; this.c.a(context, "HMSCore"); } public void a(int i, String str, String str2) { try { if (a(i)) { e a = a(i, str, str2, null); StringBuilder sb = new StringBuilder(); sb.append(a.c()); sb.append(a.a()); this.c.a(sb.toString(), i, str, str2); } } catch (OutOfMemoryError unused) { b(); } } public void a(String str, String str2) { try { e a = a(4, str, str2, null); StringBuilder sb = new StringBuilder(); sb.append(a.c()); sb.append('\n'); sb.append(a.a()); this.c.a(sb.toString(), 4, str, str2); } catch (OutOfMemoryError unused) { b(); } } private e a(int i, String str, String str2, Throwable th) { e eVar = new e(8, this.b, i, str); eVar.a((e) str2); eVar.a(th); return eVar; } public boolean a(int i) { return i >= this.a; } public void a(d dVar) { this.c = dVar; } public d a() { return this.c; } }