package io.netty.util.internal.logging;

import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.NOPLoggerFactory;

/* JADX INFO: loaded from: classes.dex */
public class Slf4JLoggerFactory extends InternalLoggerFactory {
    static final /* synthetic */ boolean $assertionsDisabled = false;
    public static final InternalLoggerFactory INSTANCE = new Slf4JLoggerFactory();

    @Deprecated
    public Slf4JLoggerFactory() {
    }

    @Override // io.netty.util.internal.logging.InternalLoggerFactory
    public InternalLogger newInstance(String str) {
        return new Slf4JLogger(LoggerFactory.getLogger(str));
    }

    Slf4JLoggerFactory(boolean z) {
        final StringBuffer stringBuffer = new StringBuffer();
        PrintStream printStream = System.err;
        try {
            System.setErr(new PrintStream(new OutputStream() { // from class: io.netty.util.internal.logging.Slf4JLoggerFactory.1
                @Override // java.io.OutputStream
                public void write(int i) {
                    stringBuffer.append((char) i);
                }
            }, true, "US-ASCII"));
            try {
                if (LoggerFactory.getILoggerFactory() instanceof NOPLoggerFactory) {
                    throw new NoClassDefFoundError(stringBuffer.toString());
                }
                printStream.print(stringBuffer);
                printStream.flush();
            } finally {
                System.setErr(printStream);
            }
        } catch (UnsupportedEncodingException e2) {
            throw new Error(e2);
        }
    }
}
