package com.ironsource.mediationsdk.logger; import com.ironsource.dk; import com.ironsource.mediationsdk.logger.IronSourceLogger; import java.util.ArrayList; import java.util.Iterator; /* loaded from: classes4.dex */ public class IronSourceLoggerManager extends IronSourceLogger implements LogListener { private static IronSourceLoggerManager d; private ArrayList c; private IronSourceLoggerManager(String str) { super(str); this.c = new ArrayList<>(); c(); } private IronSourceLoggerManager(String str, int i) { super(str, i); this.c = new ArrayList<>(); c(); } private IronSourceLogger a(String str) { Iterator it = this.c.iterator(); while (it.hasNext()) { IronSourceLogger next = it.next(); if (next.b().equals(str)) { return next; } } return null; } private void a(IronSourceLogger.IronSourceTag ironSourceTag, String str, int i) { Iterator it = this.c.iterator(); while (it.hasNext()) { IronSourceLogger next = it.next(); if (next.a() <= i) { next.log(ironSourceTag, str, i); } } } private boolean a(int i) { return i < this.a; } private void c() { this.c.add(new a(0)); } public static synchronized IronSourceLoggerManager getLogger() { IronSourceLoggerManager ironSourceLoggerManager; synchronized (IronSourceLoggerManager.class) { try { if (d == null) { d = new IronSourceLoggerManager(IronSourceLoggerManager.class.getSimpleName()); } ironSourceLoggerManager = d; } catch (Throwable th) { throw th; } } return ironSourceLoggerManager; } public static synchronized IronSourceLoggerManager getLogger(int i) { IronSourceLoggerManager ironSourceLoggerManager; synchronized (IronSourceLoggerManager.class) { try { IronSourceLoggerManager ironSourceLoggerManager2 = d; if (ironSourceLoggerManager2 == null) { d = new IronSourceLoggerManager(IronSourceLoggerManager.class.getSimpleName()); } else { ironSourceLoggerManager2.a = i; } ironSourceLoggerManager = d; } catch (Throwable th) { throw th; } } return ironSourceLoggerManager; } public synchronized void a(IronSourceLogger.IronSourceTag ironSourceTag, dk dkVar) { if (a(dkVar.a())) { return; } a(ironSourceTag, dkVar.c(), dkVar.a()); } public void addLogger(IronSourceLogger ironSourceLogger) { this.c.add(ironSourceLogger); } @Override // com.ironsource.mediationsdk.logger.IronSourceLogger @Deprecated(forRemoval = true, since = "8.3.0") public synchronized void log(IronSourceLogger.IronSourceTag ironSourceTag, String str, int i) { if (a(i)) { return; } a(ironSourceTag, str, i); } @Override // com.ironsource.mediationsdk.logger.IronSourceLogger public synchronized void logException(IronSourceLogger.IronSourceTag ironSourceTag, String str, Throwable th) { try { if (th == null) { Iterator it = this.c.iterator(); while (it.hasNext()) { it.next().log(ironSourceTag, str, 3); } } else { Iterator it2 = this.c.iterator(); while (it2.hasNext()) { it2.next().logException(ironSourceTag, str, th); } } } catch (Throwable th2) { throw th2; } } @Override // com.ironsource.mediationsdk.logger.LogListener public synchronized void onLog(IronSourceLogger.IronSourceTag ironSourceTag, String str, int i) { log(ironSourceTag, str, i); } public void setLoggerDebugLevel(String str, int i) { if (str == null) { return; } IronSourceLogger a = a(str); if (a == null) { log(IronSourceLogger.IronSourceTag.NATIVE, "Failed to find logger:setLoggerDebugLevel(loggerName:" + str + " ,debugLevel:" + i + ")", 0); return; } if (i < 0 || i > 3) { this.c.remove(a); return; } log(IronSourceLogger.IronSourceTag.NATIVE, "setLoggerDebugLevel(loggerName:" + str + " ,debugLevel:" + i + ")", 0); a.setDebugLevel(i); } }